diff options
| author | Mathias Agopian <mathias@google.com> | 2010-04-15 18:48:26 -0700 |
|---|---|---|
| committer | Mathias Agopian <mathias@google.com> | 2010-04-20 13:36:29 -0700 |
| commit | 16a86ee30b70aea8c254b836c708f54a608d25f3 (patch) | |
| tree | 9e30bb72015eeaedcc5c7d9f8303cebd2cc3e07f /include/ui | |
| parent | 6bb5ebaa0305a30b5037f6533b3b989e0437d26c (diff) | |
| download | frameworks_base-16a86ee30b70aea8c254b836c708f54a608d25f3.zip frameworks_base-16a86ee30b70aea8c254b836c708f54a608d25f3.tar.gz frameworks_base-16a86ee30b70aea8c254b836c708f54a608d25f3.tar.bz2 | |
added setCrop() to android_native_window_t
hooked up the new method up to Surface.cpp
the actual crop is not implemented in SF yet
Change-Id: Ic6e313c98fd880f127a051a0ccc71808bd689751
Diffstat (limited to 'include/ui')
| -rw-r--r-- | include/ui/egl/android_natives.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h index 773fd93..471c3c7 100644 --- a/include/ui/egl/android_natives.h +++ b/include/ui/egl/android_natives.h @@ -41,6 +41,14 @@ extern "C" { struct android_native_buffer_t; +typedef struct android_native_rect_t +{ + int32_t left; + int32_t top; + int32_t right; + int32_t bottom; +} android_native_rect_t; + // --------------------------------------------------------------------------- typedef struct android_native_base_t @@ -63,15 +71,16 @@ typedef struct android_native_base_t /* attributes queriable with query() */ enum { NATIVE_WINDOW_WIDTH = 0, - NATIVE_WINDOW_HEIGHT = 1, - NATIVE_WINDOW_FORMAT = 2, + NATIVE_WINDOW_HEIGHT, + NATIVE_WINDOW_FORMAT, }; /* valid operations for the (*perform)() hook */ enum { NATIVE_WINDOW_SET_USAGE = 0, - NATIVE_WINDOW_CONNECT = 1, - NATIVE_WINDOW_DISCONNECT = 2 + NATIVE_WINDOW_CONNECT, + NATIVE_WINDOW_DISCONNECT, + NATIVE_WINDOW_SET_CROP, }; /* parameter for NATIVE_WINDOW_[DIS]CONNECT */ @@ -125,7 +134,7 @@ typedef struct android_native_window_t * * Returns 0 on success or -errno on error. */ - int (*dequeueBuffer)(struct android_native_window_t* window, + int (*dequeueBuffer)(struct android_native_window_t* window, struct android_native_buffer_t** buffer); /* @@ -171,6 +180,7 @@ typedef struct android_native_window_t * NATIVE_WINDOW_SET_USAGE * NATIVE_WINDOW_CONNECT * NATIVE_WINDOW_DISCONNECT + * NATIVE_WINDOW_SET_CROP * */ @@ -221,6 +231,24 @@ static inline int native_window_disconnect( return window->perform(window, NATIVE_WINDOW_DISCONNECT, api); } +/* + * native_window_set_crop(..., crop) sets which region of the next queued + * buffers needs to be considered. + * A buffer's crop region is scaled to match the surface's size. + * + * The specified crop region applies to all buffers queued after it is called. + * + * if 'crop' is NULL, subsequently queued buffers won't be cropped. + * + * An error is returned if for instance the crop region is invalid, + * out of the buffer's bound or if the window is invalid. + */ +static inline int native_window_set_crop( + android_native_window_t* window, + android_native_rect_t const * crop) +{ + return window->perform(window, NATIVE_WINDOW_SET_CROP, crop); +} // --------------------------------------------------------------------------- |
