diff options
Diffstat (limited to 'core/jni/android_view_TextureView.cpp')
-rw-r--r-- | core/jni/android_view_TextureView.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp index c2bd0b3..7e05793 100644 --- a/core/jni/android_view_TextureView.cpp +++ b/core/jni/android_view_TextureView.cpp @@ -48,11 +48,6 @@ static struct { } gRectClassInfo; static struct { - jfieldID mSurfaceFormat; - jmethodID setNativeBitmap; -} gCanvasClassInfo; - -static struct { jfieldID nativeWindow; } gTextureViewClassInfo; @@ -172,13 +167,9 @@ static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject, bitmap.setPixels(NULL); } - SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer.format); - INVOKEV(canvas, gCanvasClassInfo.setNativeBitmap, reinterpret_cast<jlong>(&bitmap)); - - SkRect clipRect; - clipRect.set(rect.left, rect.top, rect.right, rect.bottom); - SkCanvas* nativeCanvas = GraphicsJNI::getNativeCanvas(env, canvas); - nativeCanvas->clipRect(clipRect); + Canvas* nativeCanvas = GraphicsJNI::getNativeCanvas(env, canvas); + nativeCanvas->setBitmap(bitmap); + nativeCanvas->clipRect(rect.left, rect.top, rect.right, rect.bottom); if (dirtyRect) { INVOKEV(dirtyRect, gRectClassInfo.set, @@ -191,7 +182,8 @@ static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject, static void android_view_TextureView_unlockCanvasAndPost(JNIEnv* env, jobject, jlong nativeWindow, jobject canvas) { - INVOKEV(canvas, gCanvasClassInfo.setNativeBitmap, (jlong)0); + Canvas* nativeCanvas = GraphicsJNI::getNativeCanvas(env, canvas); + nativeCanvas->setBitmap(SkBitmap()); if (nativeWindow) { sp<ANativeWindow> window((ANativeWindow*) nativeWindow); @@ -225,10 +217,6 @@ int register_android_view_TextureView(JNIEnv* env) { gRectClassInfo.right = GetFieldIDOrDie(env, clazz, "right", "I"); gRectClassInfo.bottom = GetFieldIDOrDie(env, clazz, "bottom", "I"); - clazz = FindClassOrDie(env, "android/graphics/Canvas"); - gCanvasClassInfo.mSurfaceFormat = GetFieldIDOrDie(env, clazz, "mSurfaceFormat", "I"); - gCanvasClassInfo.setNativeBitmap = GetMethodIDOrDie(env, clazz, "setNativeBitmap", "(J)V"); - clazz = FindClassOrDie(env, "android/view/TextureView"); gTextureViewClassInfo.nativeWindow = GetFieldIDOrDie(env, clazz, "mNativeWindow", "J"); |