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

Unified Diff: src/codec/SkAndroidCodec.cpp

Issue 1519843002: Change computeOutputColorType() to mimic old behavior (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Match old behavior for GIF and WBMP 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkAndroidCodec.cpp
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 491daf5e681b6e10167ad7d45144eaebfc371a07..d309d58501a80004c573e2dcbc39d440967a4f85 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -51,6 +51,13 @@ SkAndroidCodec* SkAndroidCodec::NewFromData(SkData* data, SkPngChunkReader* chun
}
SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorType) {
+ // The legacy GIF and WBMP decoders always decode to kIndex_8_SkColorType.
+ // We will maintain this behavior.
+ SkEncodedFormat format = this->getEncodedFormat();
+ if (kGIF_SkEncodedFormat == format || kWBMP_SkEncodedFormat == format) {
+ return kIndex_8_SkColorType;
+ }
+
SkColorType suggestedColorType = this->getInfo().colorType();
switch (requestedColorType) {
case kARGB_4444_SkColorType:
@@ -79,6 +86,13 @@ SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorTyp
break;
}
+ // Android has limited support for kGray_8 (using kAlpha_8). We will not
+ // use kGray_8 for Android unless they specifically ask for it.
+ if (kGray_8_SkColorType == suggestedColorType) {
+ return kN32_SkColorType;
+ }
+
+ // This may be kN32_SkColorType or kIndex_8_SkColorType.
return suggestedColorType;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698