Loading core/jni/android/graphics/Picture.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -42,10 +42,6 @@ Canvas* Picture::beginRecording(int width, int height) { mWidth = width; mHeight = height; SkCanvas* canvas = mRecorder->beginRecording(width, height, NULL, 0); // 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 Canvas::create_canvas(canvas); } Loading core/jni/android/graphics/SkiaCanvas.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -44,10 +44,18 @@ namespace android { // Holds an SkCanvas reference plus additional native data. class SkiaCanvas : public Canvas { public: SkiaCanvas(SkBitmap* bitmap); explicit SkiaCanvas(SkBitmap* bitmap); SkiaCanvas(SkCanvas* canvas) : mCanvas(canvas) { /** * Create a new SkiaCanvas. * * @param canvas SkCanvas to handle calls made to this SkiaCanvas. Must * not be NULL. This constructor will ref() the SkCanvas, and unref() * it in its destructor. */ explicit SkiaCanvas(SkCanvas* canvas) : mCanvas(canvas) { SkASSERT(canvas); canvas->ref(); } virtual SkCanvas* getSkCanvas() { Loading core/jni/android/graphics/pdf/PdfDocument.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -73,11 +73,6 @@ public: SkCanvas* canvas = page->mPictureRecorder->beginRecording( contentRect.width(), contentRect.height(), NULL, 0); // We pass this canvas to Java where it is used to construct // a Java Canvas object which dereferences the pointer when it // is destroyed, so we have to bump up the reference count. canvas->ref(); return canvas; } Loading include/private/graphics/Canvas.h +10 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,16 @@ public: virtual ~Canvas() {}; static Canvas* create_canvas(SkBitmap* bitmap); /** * Create a new Canvas object which delegates to an SkCanvas. * * @param skiaCanvas Must not be NULL. All drawing calls will be * delegated to this object. This function will call ref() on the * SkCanvas, and the returned Canvas will unref() it upon * destruction. * @return new Canvas object. Will not return NULL. */ static Canvas* create_canvas(SkCanvas* skiaCanvas); // TODO: enable HWUI to either create similar canvas wrapper or subclass Loading Loading
core/jni/android/graphics/Picture.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -42,10 +42,6 @@ Canvas* Picture::beginRecording(int width, int height) { mWidth = width; mHeight = height; SkCanvas* canvas = mRecorder->beginRecording(width, height, NULL, 0); // 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 Canvas::create_canvas(canvas); } Loading
core/jni/android/graphics/SkiaCanvas.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -44,10 +44,18 @@ namespace android { // Holds an SkCanvas reference plus additional native data. class SkiaCanvas : public Canvas { public: SkiaCanvas(SkBitmap* bitmap); explicit SkiaCanvas(SkBitmap* bitmap); SkiaCanvas(SkCanvas* canvas) : mCanvas(canvas) { /** * Create a new SkiaCanvas. * * @param canvas SkCanvas to handle calls made to this SkiaCanvas. Must * not be NULL. This constructor will ref() the SkCanvas, and unref() * it in its destructor. */ explicit SkiaCanvas(SkCanvas* canvas) : mCanvas(canvas) { SkASSERT(canvas); canvas->ref(); } virtual SkCanvas* getSkCanvas() { Loading
core/jni/android/graphics/pdf/PdfDocument.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -73,11 +73,6 @@ public: SkCanvas* canvas = page->mPictureRecorder->beginRecording( contentRect.width(), contentRect.height(), NULL, 0); // We pass this canvas to Java where it is used to construct // a Java Canvas object which dereferences the pointer when it // is destroyed, so we have to bump up the reference count. canvas->ref(); return canvas; } Loading
include/private/graphics/Canvas.h +10 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,16 @@ public: virtual ~Canvas() {}; static Canvas* create_canvas(SkBitmap* bitmap); /** * Create a new Canvas object which delegates to an SkCanvas. * * @param skiaCanvas Must not be NULL. All drawing calls will be * delegated to this object. This function will call ref() on the * SkCanvas, and the returned Canvas will unref() it upon * destruction. * @return new Canvas object. Will not return NULL. */ static Canvas* create_canvas(SkCanvas* skiaCanvas); // TODO: enable HWUI to either create similar canvas wrapper or subclass Loading