summaryrefslogtreecommitdiffstats
path: root/native/include/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-06-30 18:35:14 -0700
committerDianne Hackborn <hackbod@google.com>2010-07-01 14:43:23 -0700
commit54a181b1a2b1517a9479b21fbf7705a688232faf (patch)
tree90bf20d8f5f818d357c677cb713e964b920dea67 /native/include/android
parent65c83b906d01c3c1493d0547757dbb16d4c3722a (diff)
downloadframeworks_base-54a181b1a2b1517a9479b21fbf7705a688232faf.zip
frameworks_base-54a181b1a2b1517a9479b21fbf7705a688232faf.tar.gz
frameworks_base-54a181b1a2b1517a9479b21fbf7705a688232faf.tar.bz2
Make real API for native code to get its window.
Added implementation to use ANativeWindow and provide it to a NativeActivity. Change-Id: I890d71b6e15d4af71e6cf81b327961d7061ec1c2
Diffstat (limited to 'native/include/android')
-rw-r--r--native/include/android/native_activity.h31
-rw-r--r--native/include/android/native_window.h17
2 files changed, 30 insertions, 18 deletions
diff --git a/native/include/android/native_activity.h b/native/include/android/native_activity.h
index c5c8f9d..d23e40f 100644
--- a/native/include/android/native_activity.h
+++ b/native/include/android/native_activity.h
@@ -24,15 +24,12 @@
#include <jni.h>
#include <android/input.h>
+#include <android/native_window.h>
#ifdef __cplusplus
extern "C" {
#endif
-// Temporary until native surface API is defined.
-struct ASurfaceHolder;
-typedef struct ASurfaceHolder ASurfaceHolder;
-
struct ANativeActivityCallbacks;
/**
@@ -129,30 +126,28 @@ typedef struct ANativeActivityCallbacks {
void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus);
/**
- * The drawing surface for this native activity has been created. You
- * can use the given surface object to start drawing. NOTE: surface
- * drawing API is not yet defined.
+ * The drawing window for this native activity has been created. You
+ * can use the given native window object to start drawing.
*/
- void (*onSurfaceCreated)(ANativeActivity* activity, ASurfaceHolder* surface);
+ void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window);
/**
- * The drawing surface for this native activity has changed. The surface
- * given here is guaranteed to be the same as the one last given to
- * onSurfaceCreated. This is simply to inform you about interesting
- * changed to that surface.
+ * The drawing window for this native activity has changed. During this time,
+ * old ANativeWindow object is still valid but no longer active and drawing
+ * should switch to the new ANativeWindow given here. After returning from
+ * this function, you must not touch the old window.
*/
- void (*onSurfaceChanged)(ANativeActivity* activity, ASurfaceHolder* surface,
- int format, int width, int height);
+ void (*onNativeWindowChanged)(ANativeActivity* activity, ANativeWindow* window);
/**
- * The drawing surface for this native activity is going to be destroyed.
- * You MUST ensure that you do not touch the surface object after returning
- * from this function: in the common case of drawing to the surface from
+ * The drawing window for this native activity is going to be destroyed.
+ * You MUST ensure that you do not touch the window object after returning
+ * from this function: in the common case of drawing to the window from
* another thread, that means the implementation of this callback must
* properly synchronize with the other thread to stop its drawing before
* returning from here.
*/
- void (*onSurfaceDestroyed)(ANativeActivity* activity, ASurfaceHolder* surface);
+ void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window);
/**
* The input queue for this native activity's window has been created.
diff --git a/native/include/android/native_window.h b/native/include/android/native_window.h
index e6d5fea..b3f47b2 100644
--- a/native/include/android/native_window.h
+++ b/native/include/android/native_window.h
@@ -25,6 +25,23 @@ extern "C" {
struct ANativeWindow;
typedef struct ANativeWindow ANativeWindow;
+/*
+ * Return the current width in pixels of the window surface. Returns a
+ * negative value on error.
+ */
+int32_t ANativeWindow_getWidth(ANativeWindow* window);
+
+/*
+ * Return the current height in pixels of the window surface. Returns a
+ * negative value on error.
+ */
+int32_t ANativeWindow_getHeight(ANativeWindow* window);
+
+/*
+ * Return the current pixel format of the window surface. Returns a
+ * negative value on error.
+ */
+int32_t ANativeWindow_getFormat(ANativeWindow* window);
#ifdef __cplusplus
};