summaryrefslogtreecommitdiffstats
path: root/include/system/window.h
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-07-07 11:51:48 -0700
committerJamie Gennis <jgennis@google.com>2011-07-07 11:51:48 -0700
commit208ec5ec564597bdf8b478a424cc9ccc09547bac (patch)
treec187dbcd55eaf68516fdb935d17587d3c88afed3 /include/system/window.h
parent5744d312c87cde7a5672f56120164078ca9f653a (diff)
downloadsystem_core-208ec5ec564597bdf8b478a424cc9ccc09547bac.zip
system_core-208ec5ec564597bdf8b478a424cc9ccc09547bac.tar.gz
system_core-208ec5ec564597bdf8b478a424cc9ccc09547bac.tar.bz2
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
Diffstat (limited to 'include/system/window.h')
-rw-r--r--include/system/window.h50
1 files changed, 42 insertions, 8 deletions
diff --git a/include/system/window.h b/include/system/window.h
index eef567d..a990a09 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -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,23 +408,53 @@ 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.
+ * 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.
+ *
+ * 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,
+ int w, int h, int format)
+{
+ return window->perform(window, 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 composition.
+ * upon window composition.
*
- * 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.
+ * 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_geometry(
+static inline int native_window_set_buffers_dimensions(
struct ANativeWindow* window,
- int w, int h, int format)
+ int w, int h)
{
- return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
- w, h, format);
+ 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);
}
/*