summaryrefslogtreecommitdiffstats
path: root/native/android/native_window.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-07-13 17:39:11 -0700
committerMathias Agopian <mathias@google.com>2011-07-15 17:47:08 -0700
commit949be32b671304d5281ac0abbf30dcf4ebaa9eaf (patch)
treef12cbc9997bd2270f1a7604ba4d78739688975c3 /native/android/native_window.cpp
parent8d96f19692815aa14979c811a130b38eafc1bf65 (diff)
downloadframeworks_base-949be32b671304d5281ac0abbf30dcf4ebaa9eaf.zip
frameworks_base-949be32b671304d5281ac0abbf30dcf4ebaa9eaf.tar.gz
frameworks_base-949be32b671304d5281ac0abbf30dcf4ebaa9eaf.tar.bz2
move lock/unlock implementaion outside of Surface into SurfaceTextureClient
This makes ANativeWindow_lock/ANativeWindow_unlockAndPost work with ANativeWindows implemented by Surface and SurfaceTextureClient. Also, Surface now inherits directly from SurfaceTextureClient. Bug: 5003724 Change-Id: I9f285877c7bae9a262e9a7af91c2bae78804b2ef
Diffstat (limited to 'native/android/native_window.cpp')
-rw-r--r--native/android/native_window.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp
index 2c0e88e..5c016c4 100644
--- a/native/android/native_window.cpp
+++ b/native/android/native_window.cpp
@@ -81,39 +81,9 @@ int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
ARect* inOutDirtyBounds) {
- int type = -1;
- if (window->query(window, NATIVE_WINDOW_CONCRETE_TYPE, &type) != 0 ||
- type != NATIVE_WINDOW_SURFACE) {
- return BAD_VALUE;
- }
-
- Region dirtyRegion;
- Region* dirtyParam = NULL;
- if (inOutDirtyBounds != NULL) {
- dirtyRegion.set(*(Rect*)inOutDirtyBounds);
- dirtyParam = &dirtyRegion;
- }
-
- Surface::SurfaceInfo info;
- status_t res = static_cast<Surface*>(window)->lock(&info, dirtyParam);
- if (res != OK) {
- return -1;
- }
-
- outBuffer->width = (int32_t)info.w;
- outBuffer->height = (int32_t)info.h;
- outBuffer->stride = (int32_t)info.s;
- outBuffer->format = (int32_t)info.format;
- outBuffer->bits = info.bits;
-
- if (inOutDirtyBounds != NULL) {
- *inOutDirtyBounds = dirtyRegion.getBounds();
- }
-
- return 0;
+ return window->perform(window, NATIVE_WINDOW_LOCK, outBuffer, inOutDirtyBounds);
}
int32_t ANativeWindow_unlockAndPost(ANativeWindow* window) {
- status_t res = static_cast<Surface*>(window)->unlockAndPost();
- return res == android::OK ? 0 : -1;
+ return window->perform(window, NATIVE_WINDOW_UNLOCK_AND_POST);
}