Loading core/jni/android_view_Surface.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <ui/Region.h> #include <ui/Rect.h> #include <EGL/egl.h> #include <SkCanvas.h> #include <SkBitmap.h> #include <SkRegion.h> Loading Loading @@ -177,6 +179,11 @@ static sp<Surface> getSurface(JNIEnv* env, jobject clazz) return result; } EGLNativeWindowType android_Surface_getEGLNativeWindow( JNIEnv* env, jobject clazz) { return getSurface(env, clazz).get(); } static void setSurface(JNIEnv* env, jobject clazz, const sp<Surface>& surface) { Surface* const p = (Surface*)env->GetIntField(clazz, so.surface); Loading core/jni/com_google_android_gles_jni_EGLImpl.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ namespace android { extern EGLNativeWindowType android_Surface_getEGLNativeWindow( JNIEnv* env, jobject clazz); static jclass gDisplay_class; static jclass gContext_class; static jclass gSurface_class; Loading Loading @@ -95,9 +98,6 @@ static void nativeClassInit(JNIEnv *_env, jclass eglImplClass) gSurface_NativePixelRefFieldID = _env->GetFieldID(gSurface_class, "mNativePixelRef", "I"); gConfig_EGLConfigFieldID = _env->GetFieldID(gConfig_class, "mEGLConfig", "I"); jclass surface_class = _env->FindClass("android/view/Surface"); gSurface_SurfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I"); jclass bitmap_class = _env->FindClass("android/graphics/Bitmap"); gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "I"); } Loading Loading @@ -325,14 +325,15 @@ static jint jni_eglCreateWindowSurface(JNIEnv *_env, jobject _this, jobject disp } EGLDisplay dpy = getDisplay(_env, display); EGLContext cnf = getConfig(_env, config); Surface* window = 0; EGLNativeWindowType window = 0; if (native_window == NULL) { not_valid_surface: doThrow(_env, "java/lang/IllegalArgumentException", "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"); return 0; } window = (Surface*)_env->GetIntField(native_window, gSurface_SurfaceFieldID); window = android_Surface_getEGLNativeWindow(_env, native_window); if (window == NULL) goto not_valid_surface; Loading Loading
core/jni/android_view_Surface.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <ui/Region.h> #include <ui/Rect.h> #include <EGL/egl.h> #include <SkCanvas.h> #include <SkBitmap.h> #include <SkRegion.h> Loading Loading @@ -177,6 +179,11 @@ static sp<Surface> getSurface(JNIEnv* env, jobject clazz) return result; } EGLNativeWindowType android_Surface_getEGLNativeWindow( JNIEnv* env, jobject clazz) { return getSurface(env, clazz).get(); } static void setSurface(JNIEnv* env, jobject clazz, const sp<Surface>& surface) { Surface* const p = (Surface*)env->GetIntField(clazz, so.surface); Loading
core/jni/com_google_android_gles_jni_EGLImpl.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ namespace android { extern EGLNativeWindowType android_Surface_getEGLNativeWindow( JNIEnv* env, jobject clazz); static jclass gDisplay_class; static jclass gContext_class; static jclass gSurface_class; Loading Loading @@ -95,9 +98,6 @@ static void nativeClassInit(JNIEnv *_env, jclass eglImplClass) gSurface_NativePixelRefFieldID = _env->GetFieldID(gSurface_class, "mNativePixelRef", "I"); gConfig_EGLConfigFieldID = _env->GetFieldID(gConfig_class, "mEGLConfig", "I"); jclass surface_class = _env->FindClass("android/view/Surface"); gSurface_SurfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I"); jclass bitmap_class = _env->FindClass("android/graphics/Bitmap"); gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "I"); } Loading Loading @@ -325,14 +325,15 @@ static jint jni_eglCreateWindowSurface(JNIEnv *_env, jobject _this, jobject disp } EGLDisplay dpy = getDisplay(_env, display); EGLContext cnf = getConfig(_env, config); Surface* window = 0; EGLNativeWindowType window = 0; if (native_window == NULL) { not_valid_surface: doThrow(_env, "java/lang/IllegalArgumentException", "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"); return 0; } window = (Surface*)_env->GetIntField(native_window, gSurface_SurfaceFieldID); window = android_Surface_getEGLNativeWindow(_env, native_window); if (window == NULL) goto not_valid_surface; Loading