diff options
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 9c81e836f2..ef4cdd9c9a 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -223,6 +223,24 @@ public: static size_t ComputeSize(Config, int width, int height); /** + * This will brute-force return true if all of the pixels in the bitmap + * are opaque. If it fails to read the pixels, or encounters an error, + * it will return false. + * + * Since this can be an expensive operation, the bitmap stores a flag for + * this (isOpaque, setIsOpaque). Only call this if you need to compute this + * value from "unknown" pixels. + */ + static bool ComputeIsOpaque(const SkBitmap&); + + /** + * Calls ComputeIsOpaque, and passes its result to setIsOpaque(). + */ + void computeAndSetOpaquePredicate() { + this->setIsOpaque(ComputeIsOpaque(*this)); + } + + /** * Return the bitmap's bounds [0, 0, width, height] as an SkRect */ void getBounds(SkRect* bounds) const; |