summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-03-04 11:44:32 -0800
committerGlenn Kasten <gkasten@google.com>2011-03-04 16:39:29 -0800
commit846db33313aa0899fa7928256c6734964bd92520 (patch)
tree0303f6c1c11c297dd7f40f7c0725a3cfa0f14791 /core/jni
parent91ac3dc06d1b99c5e63cda3b5ae0adfec406fd7a (diff)
downloadframeworks_base-846db33313aa0899fa7928256c6734964bd92520.zip
frameworks_base-846db33313aa0899fa7928256c6734964bd92520.tar.gz
frameworks_base-846db33313aa0899fa7928256c6734964bd92520.tar.bz2
Bug 3515073 Add ANativeWindow_fromSurfaceTexture
This is similar to ANativeWindow_fromSurface. Change-Id: Iaadc06a5d0d50685c34876aa89488c16e7cfaa65
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/SurfaceTexture.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index 88de94f..c4e5878 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
#include <android_runtime/AndroidRuntime.h>
@@ -64,6 +65,15 @@ sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz)
return surfaceTexture;
}
+sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(
+ JNIEnv* env, jobject thiz)
+{
+ sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ?
+ new SurfaceTextureClient(surfaceTexture) : NULL);
+ return surfaceTextureClient;
+}
+
// ----------------------------------------------------------------------------
class JNISurfaceTextureContext : public SurfaceTexture::FrameAvailableListener