First cut at RSTextureView.
Change-Id: I920950f33079b6bb7e48bb8970201ab9737bb021
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 7e53cc4..4a85faf 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 The Android Open Source Project
+ * Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,9 @@
#include <RenderScript.h>
#include <RenderScriptEnv.h>
+#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
//#define LOG_API LOGE
#define LOG_API(...)
@@ -201,6 +204,23 @@
}
static void
+nContextSetSurfaceTexture(JNIEnv *_env, jobject _this, RsContext con, jint width, jint height, jobject sur)
+{
+ LOG_API("nContextSetSurfaceTexture, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)sur);
+
+ sp<ANativeWindow> window;
+ sp<SurfaceTexture> st;
+ if (sur == 0) {
+
+ } else {
+ st = SurfaceTexture_getSurfaceTexture(_env, sur);
+ window = new SurfaceTextureClient(st);
+ }
+
+ rsContextSetSurface(con, width, height, window.get());
+}
+
+static void
nContextDestroy(JNIEnv *_env, jobject _this, RsContext con)
{
LOG_API("nContextDestroy, con(%p)", con);
@@ -1197,6 +1217,7 @@
{"rsnContextFinish", "(I)V", (void*)nContextFinish },
{"rsnContextSetPriority", "(II)V", (void*)nContextSetPriority },
{"rsnContextSetSurface", "(IIILandroid/view/Surface;)V", (void*)nContextSetSurface },
+{"rsnContextSetSurfaceTexture", "(IIILandroid/graphics/SurfaceTexture;)V", (void*)nContextSetSurfaceTexture },
{"rsnContextDestroy", "(I)V", (void*)nContextDestroy },
{"rsnContextDump", "(II)V", (void*)nContextDump },
{"rsnContextPause", "(I)V", (void*)nContextPause },