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

Unified Diff: include/codec/SkCodec.h

Issue 1518743002: Add reallyHasAlpha() to SkAndroidCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 67ccdb241c3225e35e09ef2b75d1fd60bbd64a6b..02d4469ba66049aae9aeac86b7c233e67a854b32 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -486,7 +486,13 @@ protected:
return false;
}
- virtual bool onReallyHasAlpha() const { return false; }
+ virtual bool onReallyHasAlpha() const {
+ // Opaque images never have alpha. If the image indicates that it
+ // does have alpha, by default, we will assume this to be true.
+ // Subclasses may override this function if they intend to verify
+ // that the image actually has alpha.
+ return kOpaque_SkAlphaType != this->getInfo().alphaType();
scroggo 2015/12/10 17:02:32 SkWebpCodec's implementation looks like this (and
msarett 2015/12/10 17:41:18 Yes I think so. Or we should make this pure virtu
scroggo 2015/12/10 18:29:42 Yeah, I think we have a note about that in skbug.c
+ }
/**
* If the stream was previously read, attempt to rewind.

Powered by Google App Engine
This is Rietveld 408576698