diff options
Diffstat (limited to 'core/jni/android_graphics_Picture.cpp')
| -rw-r--r-- | core/jni/android_graphics_Picture.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/jni/android_graphics_Picture.cpp b/core/jni/android_graphics_Picture.cpp index eb8f6dd..f827907 100644 --- a/core/jni/android_graphics_Picture.cpp +++ b/core/jni/android_graphics_Picture.cpp @@ -51,7 +51,7 @@ static void android_graphics_Picture_killPicture(JNIEnv* env, jobject, jlong pic static void android_graphics_Picture_draw(JNIEnv* env, jobject, jlong canvasHandle, jlong pictureHandle) { - Canvas* canvas = reinterpret_cast<Canvas*>(canvasHandle); + SkCanvas* canvas = GraphicsJNI::getNativeCanvas(canvasHandle); Picture* picture = reinterpret_cast<Picture*>(pictureHandle); SkASSERT(canvas); SkASSERT(picture); @@ -84,7 +84,12 @@ static jint android_graphics_Picture_getHeight(JNIEnv* env, jobject, jlong pictu static jlong android_graphics_Picture_beginRecording(JNIEnv* env, jobject, jlong pictHandle, jint w, jint h) { Picture* pict = reinterpret_cast<Picture*>(pictHandle); - Canvas* canvas = pict->beginRecording(w, h); + // beginRecording does not ref its return value, it just returns it. + SkCanvas* canvas = pict->beginRecording(w, h); + // the java side will wrap this guy in a Canvas.java, which will call + // unref in its finalizer, so we have to ref it here, so that both that + // Canvas.java and our picture can both be owners + canvas->ref(); return reinterpret_cast<jlong>(canvas); } |
