Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: include/core/SkBitmap.h

Issue 154083004: SkPictureRecord: silently do nothing for non-drawable SkBitmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: really, last rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 4951cf19cf7b15ef70dd1a09035f2ef7b95dbcce..87d4649228b48dfb7891768306e5898d98f190ad 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; }
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698