diff options
Diffstat (limited to 'graphics/jni')
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 27 |
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 }, |