diff options
Diffstat (limited to 'core/jni/com_google_android_gles_jni_EGLImpl.cpp')
-rw-r--r-- | core/jni/com_google_android_gles_jni_EGLImpl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 7080e2a..6c21bab 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -30,7 +30,6 @@ #include <gui/GLConsumer.h> #include <gui/Surface.h> -#include <GraphicsJNI.h> #include <SkBitmap.h> #include <SkPixelRef.h> @@ -47,6 +46,7 @@ static jfieldID gContext_EGLContextFieldID; static jfieldID gSurface_EGLSurfaceFieldID; static jfieldID gSurface_NativePixelRefFieldID; static jfieldID gConfig_EGLConfigFieldID; +static jfieldID gBitmap_NativeBitmapFieldID; static inline EGLDisplay getDisplay(JNIEnv* env, jobject o) { if (!o) return EGL_NO_DISPLAY; @@ -85,6 +85,9 @@ static void nativeClassInit(JNIEnv *_env, jclass eglImplClass) jclass surface_class = _env->FindClass("com/google/android/gles_jni/EGLSurfaceImpl"); gSurface_EGLSurfaceFieldID = _env->GetFieldID(surface_class, "mEGLSurface", "J"); gSurface_NativePixelRefFieldID = _env->GetFieldID(surface_class, "mNativePixelRef", "J"); + + jclass bitmap_class = _env->FindClass("android/graphics/Bitmap"); + gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "J"); } static const jint gNull_attrib_base[] = {EGL_NONE}; @@ -277,7 +280,9 @@ static void jni_eglCreatePixmapSurface(JNIEnv *_env, jobject _this, jobject out_ EGLConfig cnf = getConfig(_env, config); jint* base = 0; - SkBitmap const * nativeBitmap = GraphicsJNI::getSkBitmap(_env, native_pixmap); + SkBitmap const * nativeBitmap = + (SkBitmap const *)_env->GetLongField(native_pixmap, + gBitmap_NativeBitmapFieldID); SkPixelRef* ref = nativeBitmap ? nativeBitmap->pixelRef() : 0; if (ref == NULL) { jniThrowException(_env, "java/lang/IllegalArgumentException", "Bitmap has no PixelRef"); |