summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-11-12 15:10:25 -0800
committerJason Sams <rjsams@android.com>2009-11-12 15:10:47 -0800
commit3bc47d438171dce294e816366d53bc9eca772c5b (patch)
tree58c41bf03b538359d7dd70fcd8362195a5405445 /graphics/jni
parentb602c328c24f82d61038ac1222bd40a3cc7bc900 (diff)
downloadframeworks_base-3bc47d438171dce294e816366d53bc9eca772c5b.zip
frameworks_base-3bc47d438171dce294e816366d53bc9eca772c5b.tar.gz
frameworks_base-3bc47d438171dce294e816366d53bc9eca772c5b.tar.bz2
Defer EGL init until the surface changed call comes in. Pass w,h along with surface for verification of driver state.
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index f3dda41..709cb97 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -151,30 +151,17 @@ nDeviceSetConfig(JNIEnv *_env, jobject _this, jint dev, jint p, jint value)
}
static jint
-nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver, jboolean useDepth)
+nContextCreate(JNIEnv *_env, jobject _this, jint dev, jint ver, jboolean useDepth)
{
LOG_API("nContextCreate");
-
- if (wnd == NULL) {
- not_valid_surface:
- doThrow(_env, "java/lang/IllegalArgumentException",
- "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface");
- return 0;
- }
- jclass surface_class = _env->FindClass("android/view/Surface");
- jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I");
- Surface * window = (Surface*)_env->GetIntField(wnd, surfaceFieldID);
- if (window == NULL)
- goto not_valid_surface;
-
- return (jint)rsContextCreate((RsDevice)dev, window, ver, useDepth);
+ return (jint)rsContextCreate((RsDevice)dev, ver, useDepth);
}
static void
-nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd)
+nContextSetSurface(JNIEnv *_env, jobject _this, jint width, jint height, jobject wnd)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nContextSetSurface, con(%p), surface(%p)", con, (Surface *)wnd);
+ LOG_API("nContextSetSurface, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)wnd);
Surface * window = NULL;
if (wnd == NULL) {
@@ -185,7 +172,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd)
window = (Surface*)_env->GetIntField(wnd, surfaceFieldID);
}
- rsContextSetSurface(con, window);
+ rsContextSetSurface(con, width, height, window);
}
static void
@@ -1345,8 +1332,8 @@ static JNINativeMethod methods[] = {
{"nDeviceCreate", "()I", (void*)nDeviceCreate },
{"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy },
{"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig },
-{"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate },
-{"nContextSetSurface", "(Landroid/view/Surface;)V", (void*)nContextSetSurface },
+{"nContextCreate", "(IIZ)I", (void*)nContextCreate },
+{"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface },
{"nContextDestroy", "(I)V", (void*)nContextDestroy },
{"nContextPause", "()V", (void*)nContextPause },
{"nContextResume", "()V", (void*)nContextResume },