summaryrefslogtreecommitdiffstats
path: root/core/jni/android_graphics_Canvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/jni/android_graphics_Canvas.cpp')
-rw-r--r--core/jni/android_graphics_Canvas.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index 50a1069..a2c1609 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -39,22 +39,17 @@ static void finalizer(JNIEnv* env, jobject clazz, jlong canvasHandle) {
}
// Native wrapper constructor used by Canvas(Bitmap)
-static jlong initRaster(JNIEnv* env, jobject, jobject jbitmap) {
- SkBitmap bitmap;
- if (jbitmap != NULL) {
- GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap);
- }
+static jlong initRaster(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
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, jobject jbitmap) {
- SkBitmap bitmap;
- if (jbitmap != NULL) {
- GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap);
- }
- get_canvas(canvasHandle)->setBitmap(bitmap);
+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 jboolean isOpaque(JNIEnv*, jobject, jlong canvasHandle) {
@@ -663,8 +658,8 @@ static void freeTextLayoutCaches(JNIEnv* env, jobject) {
static JNINativeMethod gMethods[] = {
{"finalizer", "(J)V", (void*) CanvasJNI::finalizer},
- {"initRaster", "(Landroid/graphics/Bitmap;)J", (void*) CanvasJNI::initRaster},
- {"native_setBitmap", "(JLandroid/graphics/Bitmap;)V", (void*) CanvasJNI::setBitmap},
+ {"initRaster", "(J)J", (void*) CanvasJNI::initRaster},
+ {"native_setBitmap", "(JJZ)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},