aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-06-03 13:12:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-03 13:12:51 -0700
commit65044bfe021e9c0023d78080583e9acb3bdb5ce7 (patch)
tree79345f8bd3f3933cd1944745396558caa7b043a5 /include
parent99ffe24200d8940ceba20f6fbf8c460f994d3cd1 (diff)
Return NULL when building empty LayerRasterizer.
In SkLayerRasterizer::snapshotRasterizer() and ::detachRasterizer(), if no layers have been added, do not attempt to create an SkLayerRasterizer. Instead, return NULL. This fixes an error when running tests on Android. Update dox to state that NULL may be returned. Add tests. R=reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/313653006
Diffstat (limited to 'include')
-rw-r--r--include/effects/SkLayerRasterizer.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/effects/SkLayerRasterizer.h b/include/effects/SkLayerRasterizer.h
index fc21a7cd18..9d4c8239f2 100644
--- a/include/effects/SkLayerRasterizer.h
+++ b/include/effects/SkLayerRasterizer.h
@@ -39,9 +39,10 @@ public:
/**
* Pass queue of layers on to newly created layer rasterizer and return it. The builder
- * *cannot* be used any more after calling this function.
+ * *cannot* be used any more after calling this function. If no layers have been added,
+ * returns NULL.
*
- * The caller is responsible for calling unref() on the returned object.
+ * The caller is responsible for calling unref() on the returned object, if non NULL.
*/
SkLayerRasterizer* detachRasterizer();
@@ -51,11 +52,11 @@ public:
* *may* be used after calling this function. It will continue to hold any layers
* previously added, so consecutive calls to this function will return identical objects,
* and objects returned by future calls to this function contain all the layers in
- * previously returned objects.
+ * previously returned objects. If no layers have been added, returns NULL.
*
* Future calls to addLayer will not affect rasterizers previously returned by this call.
*
- * The caller is responsible for calling unref() on the returned object.
+ * The caller is responsible for calling unref() on the returned object, if non NULL.
*/
SkLayerRasterizer* snapshotRasterizer() const;