summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2010-08-19 18:56:00 -0700
committerJim Miller <jaggies@google.com>2010-08-19 18:56:00 -0700
commitee956053d6e3f7a7a82e41853b9b251fdc226d7a (patch)
tree11888dd8dc44ad5771b10782708693ff731dde7d /graphics/jni
parent2c5678d7b3f9811ca441f3720ce2c778fdaa0a6d (diff)
downloadframeworks_base-ee956053d6e3f7a7a82e41853b9b251fdc226d7a.zip
frameworks_base-ee956053d6e3f7a7a82e41853b9b251fdc226d7a.tar.gz
frameworks_base-ee956053d6e3f7a7a82e41853b9b251fdc226d7a.tar.bz2
Make sure we have a native Surface in nContextSetSurface.
I was seeing a problem running RenderScript in the system process because mNativeSurface was null. This works around the problem by forcing the native surface to be created when we set the surface. Change-Id: I3abf6cef1b049864e4e063669b6df547de008c93
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 3624678..b2e8dd9 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -37,6 +37,7 @@
#include "jni.h"
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
+#include "android_runtime/android_view_Surface.h"
#include <RenderScript.h>
#include <RenderScriptEnv.h>
@@ -184,9 +185,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, RsContext con, jint width, jint
if (wnd == NULL) {
} else {
- jclass surface_class = _env->FindClass("android/view/Surface");
- jfieldID surfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I");
- window = (Surface*)_env->GetIntField(wnd, surfaceFieldID);
+ window = (Surface*) android_Surface_getNativeWindow(_env, wnd).get();
}
rsContextSetSurface(con, width, height, window);