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

Unified Diff: src/image/SkImage_Codec.cpp

Issue 406673003: Add the method isOpaque() to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « include/core/SkImage.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Codec.cpp
diff --git a/src/image/SkImage_Codec.cpp b/src/image/SkImage_Codec.cpp
index 3d815ce7f437409156b94c009a26e733ca77a270..8377655e27f68a06e113b466db90f6f7d5e40267 100644
--- a/src/image/SkImage_Codec.cpp
+++ b/src/image/SkImage_Codec.cpp
@@ -21,6 +21,8 @@ public:
virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRIDE;
virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE;
+ virtual bool isOpaque() const SK_OVERRIDE;
+
private:
SkData* fEncodedData;
SkBitmap fBitmap;
@@ -73,3 +75,12 @@ SkImage* SkImage::NewEncodedData(SkData* data) {
return SkNEW_ARGS(SkImage_Codec, (data, bitmap.width(), bitmap.height()));
}
+
+
+bool SkImage_Codec::isOpaque() const {
+ if (!fBitmap.pixelRef()) {
+ return SkImage::isOpaque();
reed1 2014/07/18 20:50:02 This will return false, even if the bitmap is opaq
Rémi Piotaix 2014/07/18 21:12:50 Yep. I made this method const so SkImageDecoder::D
scroggo 2014/07/18 21:39:14 It does seem to me that fBitmap is logically mutab
+ }
+
+ return fBitmap.isOpaque();
+}
« no previous file with comments | « include/core/SkImage.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698