aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-10 18:29:10 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-10 18:29:10 +0000
commit50b393a768c0311b3210f723325fd27bf161136b (patch)
treebd202eac46cbfdc0dcb81a617133a3dfc203e56e /include
parent9985ef5ed8c0b5cf3530ccf13c0774c6ef6256dd (diff)
SkPictureRecord: silently do nothing for non-drawable SkBitmaps.
BUG=skia:2135 R=reed@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/154083004 git-svn-id: http://skia.googlecode.com/svn/trunk@13386 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 4951cf19cf..87d4649228 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -80,14 +80,20 @@ public:
void swap(SkBitmap& other);
/** Return true iff the bitmap has empty dimensions.
- */
+ * Hey! Before you use this, see if you really want to know drawsNothing() instead.
+ */
bool empty() const { return 0 == fWidth || 0 == fHeight; }
/** Return true iff the bitmap has no pixelref. Note: this can return true even if the
- dimensions of the bitmap are > 0 (see empty()).
- */
+ * dimensions of the bitmap are > 0 (see empty()).
+ * Hey! Before you use this, see if you really want to know drawsNothing() instead.
+ */
bool isNull() const { return NULL == fPixelRef; }
+ /** Return true iff drawing this bitmap has no effect.
+ */
+ bool drawsNothing() const { return this->empty() || this->isNull(); }
+
/** Return the config for the bitmap. */
Config config() const { return (Config)fConfig; }