diff options
author | 2016-12-07 15:24:59 -0500 | |
---|---|---|
committer | 2016-12-07 21:44:39 +0000 | |
commit | 58a769490a4593a93b08031365b88be7a5ecfa0e (patch) | |
tree | 62906a1b64a6a6a1db8ab56e137b66cd1a9e5c02 /include/core/SkPixmap.h | |
parent | e1f29c7b3c301ba8aa649ca8fb74237b4960fd4f (diff) |
SkBitmap::ComputeIsOpaque -> SkPixmap::computeIsOpaque
Motivation: Twice internal Skia clients have to do something awkward like this:
bool ComputeIsOpaque(const SkPixmap& pixmap) {
SkBitmap bm;
return bm.installPixels(pixmap) && SkBitmap::ComputeIsOpaque(bm);
}
Change-Id: I7263c06f754c1305ecb07c4c005d9cfb9d1f523d
Reviewed-on: https://skia-review.googlesource.com/5684
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'include/core/SkPixmap.h')
-rw-r--r-- | include/core/SkPixmap.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h index ce13297fb9..6cf948e601 100644 --- a/include/core/SkPixmap.h +++ b/include/core/SkPixmap.h @@ -91,6 +91,12 @@ public: size_t getSafeSize() const { return fInfo.getSafeSize(fRowBytes); } /** + * This will brute-force return true if all of the pixels in the pixmap + * are opaque. If there are no pixels, or encounters an error, returns false. + */ + bool computeIsOpaque() const; + + /** * Converts the pixel at the specified coordinate to an unpremultiplied * SkColor. Note: this ignores any SkColorSpace information, and may return * lower precision data than is actually in the pixel. Alpha only |