diff options
Diffstat (limited to 'core/jni/android_graphics_Canvas.cpp')
-rw-r--r-- | core/jni/android_graphics_Canvas.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp index a2c1609..50a1069 100644 --- a/core/jni/android_graphics_Canvas.cpp +++ b/core/jni/android_graphics_Canvas.cpp @@ -39,17 +39,22 @@ static void finalizer(JNIEnv* env, jobject clazz, jlong canvasHandle) { } // Native wrapper constructor used by Canvas(Bitmap) -static jlong initRaster(JNIEnv* env, jobject, jlong bitmapHandle) { - SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); +static jlong initRaster(JNIEnv* env, jobject, jobject jbitmap) { + SkBitmap bitmap; + if (jbitmap != NULL) { + GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap); + } return reinterpret_cast<jlong>(Canvas::create_canvas(bitmap)); } // Set the given bitmap as the new draw target (wrapped in a new SkCanvas), // optionally copying canvas matrix & clip state. -static void setBitmap(JNIEnv* env, jobject, jlong canvasHandle, jlong bitmapHandle, - jboolean copyState) { - SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); - get_canvas(canvasHandle)->setBitmap(bitmap, copyState); +static void setBitmap(JNIEnv* env, jobject, jlong canvasHandle, jobject jbitmap) { + SkBitmap bitmap; + if (jbitmap != NULL) { + GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap); + } + get_canvas(canvasHandle)->setBitmap(bitmap); } static jboolean isOpaque(JNIEnv*, jobject, jlong canvasHandle) { @@ -658,8 +663,8 @@ static void freeTextLayoutCaches(JNIEnv* env, jobject) { static JNINativeMethod gMethods[] = { {"finalizer", "(J)V", (void*) CanvasJNI::finalizer}, - {"initRaster", "(J)J", (void*) CanvasJNI::initRaster}, - {"native_setBitmap", "(JJZ)V", (void*) CanvasJNI::setBitmap}, + {"initRaster", "(Landroid/graphics/Bitmap;)J", (void*) CanvasJNI::initRaster}, + {"native_setBitmap", "(JLandroid/graphics/Bitmap;)V", (void*) CanvasJNI::setBitmap}, {"native_isOpaque","(J)Z", (void*) CanvasJNI::isOpaque}, {"native_getWidth","(J)I", (void*) CanvasJNI::getWidth}, {"native_getHeight","(J)I", (void*) CanvasJNI::getHeight}, |