ANativeWindow: add setters for dimensions and fmt
This change adds two new 'perform' setters to set the dimensions and pixel format of the buffers that will be dequeued from the ANativeWindow. These new setters provide the same functionality as _SET_BUFFERS_GEOMETRY, but allow the format and dimensions to be set independently. The _SET_BUFFERS_GEOMETRY setter is still supported to maintain backwards compatibility. Change-Id: Ib49b7798ffebe61eff2c8e4202fc3048cfec7bdd
This commit is contained in:
parent
5744d312c8
commit
208ec5ec56
1 changed files with 43 additions and 9 deletions
|
|
@ -165,6 +165,8 @@ enum {
|
|||
NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
|
||||
NATIVE_WINDOW_SET_BUFFERS_TRANSFORM,
|
||||
NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP,
|
||||
NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS,
|
||||
NATIVE_WINDOW_SET_BUFFERS_FORMAT,
|
||||
};
|
||||
|
||||
/* parameter for NATIVE_WINDOW_[DIS]CONNECT */
|
||||
|
|
@ -306,6 +308,8 @@ struct ANativeWindow
|
|||
* NATIVE_WINDOW_SET_BUFFERS_GEOMETRY
|
||||
* NATIVE_WINDOW_SET_BUFFERS_TRANSFORM
|
||||
* NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
|
||||
* NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS
|
||||
* NATIVE_WINDOW_SET_BUFFERS_FORMAT
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -404,16 +408,12 @@ static inline int native_window_set_buffer_count(
|
|||
|
||||
/*
|
||||
* native_window_set_buffers_geometry(..., int w, int h, int format)
|
||||
* All buffers dequeued after this call will have the geometry specified.
|
||||
* In particular, all buffers will have a fixed-size, independent form the
|
||||
* native-window size. They will be appropriately scaled to the window-size
|
||||
* upon composition.
|
||||
* All buffers dequeued after this call will have the dimensions and format
|
||||
* specified. A successful call to this function has the same effect as calling
|
||||
* native_window_set_buffers_size and native_window_set_buffers_format.
|
||||
*
|
||||
* If all parameters are 0, the normal behavior is restored. That is,
|
||||
* dequeued buffers following this call will be sized to the window's size.
|
||||
*
|
||||
* Calling this function will reset the window crop to a NULL value, which
|
||||
* disables cropping of the buffers.
|
||||
* XXX: This function is deprecated. The native_window_set_buffers_dimensions
|
||||
* and native_window_set_buffers_format functions should be used instead.
|
||||
*/
|
||||
static inline int native_window_set_buffers_geometry(
|
||||
struct ANativeWindow* window,
|
||||
|
|
@ -423,6 +423,40 @@ static inline int native_window_set_buffers_geometry(
|
|||
w, h, format);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_dimensions(..., int w, int h)
|
||||
* All buffers dequeued after this call will have the dimensions specified.
|
||||
* In particular, all buffers will have a fixed-size, independent form the
|
||||
* native-window size. They will be appropriately scaled to the window-size
|
||||
* upon window composition.
|
||||
*
|
||||
* If w and h are 0, the normal behavior is restored. That is, dequeued buffers
|
||||
* following this call will be sized to match the window's size.
|
||||
*
|
||||
* Calling this function will reset the window crop to a NULL value, which
|
||||
* disables cropping of the buffers.
|
||||
*/
|
||||
static inline int native_window_set_buffers_dimensions(
|
||||
struct ANativeWindow* window,
|
||||
int w, int h)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS,
|
||||
w, h);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_format(..., int format)
|
||||
* All buffers dequeued after this call will have the format specified.
|
||||
*
|
||||
* If the specified format is 0, the default buffer format will be used.
|
||||
*/
|
||||
static inline int native_window_set_buffers_format(
|
||||
struct ANativeWindow* window,
|
||||
int format)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_transform(..., int transform)
|
||||
* All buffers queued after this call will be displayed transformed according
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue