summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2014-12-17 11:30:31 -0500
committerLeon Scroggins III <scroggo@google.com>2014-12-17 13:20:33 -0500
commit18981294a58c411a4a33ebb22caf9c75ba639691 (patch)
tree95a659da2fb0df35f55122c60a205b2f47b70416 /include
parent43cd1ddc81d45f9e1789486826c30358d8f92ef2 (diff)
downloadframeworks_base-18981294a58c411a4a33ebb22caf9c75ba639691.zip
frameworks_base-18981294a58c411a4a33ebb22caf9c75ba639691.tar.gz
frameworks_base-18981294a58c411a4a33ebb22caf9c75ba639691.tar.bz2
Make SkiaCanvas creation call ref() on SkCanvas.
There are two callers of SkiaCanvas::create_canvas(SkCanvas*). In both cases, we were calling ref() first. It is necessary to call ref() in both cases, since we have an SkCanvas returned by SkPictureRecorder::beginRecording, which does not increment the ref count to account for the caller. (i.e. the SkPictureRecorder has the only ref until you call ref()). Rather than leave the ref up to the caller, since the SkiaCanvas does the unref(), it should also do the ref(). Update it to do so and document its behavior. Also, make SkiaCanvas' constructors explicit. Change-Id: I894d0a71a87587cf8c2b26deb2384dc49ae090ef
Diffstat (limited to 'include')
-rw-r--r--include/private/graphics/Canvas.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/private/graphics/Canvas.h b/include/private/graphics/Canvas.h
index 3cd57f4..2eda6a4 100644
--- a/include/private/graphics/Canvas.h
+++ b/include/private/graphics/Canvas.h
@@ -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