diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-06-30 16:05:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-06-30 16:05:30 -0700 |
commit | e12e3d7692cf370b8cbdb848da5201bfa0410afb (patch) | |
tree | 5036d103b2b2ebf192eec48ecc94ac5d1b20c856 /include/ui | |
parent | 05dedd17ec753ce8a791679c59504a33ad667f3c (diff) | |
parent | 4b5e91e4820f03dba7dcc36e4b148331bc964b4b (diff) | |
download | frameworks_native-e12e3d7692cf370b8cbdb848da5201bfa0410afb.zip frameworks_native-e12e3d7692cf370b8cbdb848da5201bfa0410afb.tar.gz frameworks_native-e12e3d7692cf370b8cbdb848da5201bfa0410afb.tar.bz2 |
Merge "Introduce official public NativeWindow type." into gingerbread
Diffstat (limited to 'include/ui')
-rw-r--r-- | include/ui/FramebufferNativeWindow.h | 14 | ||||
-rw-r--r-- | include/ui/egl/android_natives.h | 42 |
2 files changed, 30 insertions, 26 deletions
diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h index 8ea3ab9..0f4594f 100644 --- a/include/ui/FramebufferNativeWindow.h +++ b/include/ui/FramebufferNativeWindow.h @@ -43,7 +43,7 @@ class NativeBuffer; class FramebufferNativeWindow : public EGLNativeBase< - android_native_window_t, + ANativeWindow, FramebufferNativeWindow, LightRefBase<FramebufferNativeWindow> > { @@ -59,12 +59,12 @@ public: private: friend class LightRefBase<FramebufferNativeWindow>; ~FramebufferNativeWindow(); // this class cannot be overloaded - static int setSwapInterval(android_native_window_t* window, int interval); - static int dequeueBuffer(android_native_window_t* window, android_native_buffer_t** buffer); - static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer); - static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer); - static int query(android_native_window_t* window, int what, int* value); - static int perform(android_native_window_t* window, int operation, ...); + static int setSwapInterval(ANativeWindow* window, int interval); + static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer); + static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer); + static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer); + static int query(ANativeWindow* window, int what, int* value); + static int perform(ANativeWindow* window, int operation, ...); framebuffer_device_t* fbDev; alloc_device_t* grDev; diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h index 171f3df..ca89b06 100644 --- a/include/ui/egl/android_natives.h +++ b/include/ui/egl/android_natives.h @@ -22,6 +22,8 @@ #include <hardware/gralloc.h> +#include <android/native_window.h> + #ifdef __cplusplus extern "C" { #endif @@ -90,19 +92,19 @@ enum { NATIVE_WINDOW_API_EGL = 1 }; -typedef struct android_native_window_t +struct ANativeWindow { #ifdef __cplusplus - android_native_window_t() + ANativeWindow() : flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0) { common.magic = ANDROID_NATIVE_WINDOW_MAGIC; - common.version = sizeof(android_native_window_t); + common.version = sizeof(ANativeWindow); memset(common.reserved, 0, sizeof(common.reserved)); } - // Implement the methods that sp<android_native_window_t> expects so that it - // can be used to automatically refcount android_native_window_t's. + // Implement the methods that sp<ANativeWindow> expects so that it + // can be used to automatically refcount ANativeWindow's. void incStrong(const void* id) const { common.incRef(const_cast<android_native_base_t*>(&common)); } @@ -135,7 +137,7 @@ typedef struct android_native_window_t * * Returns 0 on success or -errno on error. */ - int (*setSwapInterval)(struct android_native_window_t* window, + int (*setSwapInterval)(struct ANativeWindow* window, int interval); /* @@ -145,7 +147,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 ANativeWindow* window, struct android_native_buffer_t** buffer); /* @@ -155,7 +157,7 @@ typedef struct android_native_window_t * * Returns 0 on success or -errno on error. */ - int (*lockBuffer)(struct android_native_window_t* window, + int (*lockBuffer)(struct ANativeWindow* window, struct android_native_buffer_t* buffer); /* * hook called by EGL when modifications to the render buffer are done. @@ -165,7 +167,7 @@ typedef struct android_native_window_t * * Returns 0 on success or -errno on error. */ - int (*queueBuffer)(struct android_native_window_t* window, + int (*queueBuffer)(struct ANativeWindow* window, struct android_native_buffer_t* buffer); /* @@ -173,13 +175,13 @@ typedef struct android_native_window_t * * Returns 0 on success or -errno on error. */ - int (*query)(struct android_native_window_t* window, + int (*query)(struct ANativeWindow* window, int what, int* value); /* * hook used to perform various operations on the surface. * (*perform)() is a generic mechanism to add functionality to - * android_native_window_t while keeping backward binary compatibility. + * ANativeWindow while keeping backward binary compatibility. * * This hook should not be called directly, instead use the helper functions * defined below. @@ -197,12 +199,14 @@ typedef struct android_native_window_t * */ - int (*perform)(struct android_native_window_t* window, + int (*perform)(struct ANativeWindow* window, int operation, ... ); void* reserved_proc[3]; -} android_native_window_t; +}; +// Backwards compatibility... please switch to ANativeWindow. +typedef struct ANativeWindow android_native_window_t; /* * native_window_set_usage(..., usage) @@ -216,7 +220,7 @@ typedef struct android_native_window_t */ static inline int native_window_set_usage( - android_native_window_t* window, int usage) + ANativeWindow* window, int usage) { return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage); } @@ -228,7 +232,7 @@ static inline int native_window_set_usage( * can happen if it's connected to some other API. */ static inline int native_window_connect( - android_native_window_t* window, int api) + ANativeWindow* window, int api) { return window->perform(window, NATIVE_WINDOW_CONNECT, api); } @@ -240,7 +244,7 @@ static inline int native_window_connect( * first place. */ static inline int native_window_disconnect( - android_native_window_t* window, int api) + ANativeWindow* window, int api) { return window->perform(window, NATIVE_WINDOW_DISCONNECT, api); } @@ -258,7 +262,7 @@ static inline int native_window_disconnect( * out of the buffer's bound or if the window is invalid. */ static inline int native_window_set_crop( - android_native_window_t* window, + ANativeWindow* window, android_native_rect_t const * crop) { return window->perform(window, NATIVE_WINDOW_SET_CROP, crop); @@ -269,7 +273,7 @@ static inline int native_window_set_crop( * Sets the number of buffers associated with this native window. */ static inline int native_window_set_buffer_count( - android_native_window_t* window, + ANativeWindow* window, size_t bufferCount) { return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount); @@ -287,7 +291,7 @@ static inline int native_window_set_buffer_count( * */ static inline int native_window_set_buffers_geometry( - android_native_window_t* window, + ANativeWindow* window, int w, int h, int format) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY, |