aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-06-07 16:30:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-08 13:28:29 +0000
commitb6f4767294261dca3beef6f280c4bac69df3f930 (patch)
tree298b82f81edd075ae786980b207de9cee4705c0d /src/codec
parentd7c681d6a7b154d276e275becc51685eac8705c2 (diff)
Do not return Index8 from SkAndroidCodec::computeOutputColorType
Given that this is the only known use of Index8 color type, this is essentially an experimental delete. Bug: skia:6620 Change-Id: Ib363d237e0217f6e7f461a62e54d32892c428095 Reviewed-on: https://skia-review.googlesource.com/10586 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/SkAndroidCodec.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index b30dd52e4c..6c9152b08a 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -105,39 +105,19 @@ SkAndroidCodec* SkAndroidCodec::NewFromData(sk_sp<SkData> data, SkPngChunkReader
}
SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorType) {
- // The legacy GIF and WBMP decoders always decode to kIndex_8_SkColorType.
- // We will maintain this behavior when we can.
- const SkColorType suggestedColorType = this->getInfo().colorType();
- switch ((SkEncodedImageFormat) this->getEncodedFormat()) {
- case SkEncodedImageFormat::kGIF:
- if (suggestedColorType == kIndex_8_SkColorType) {
- return kIndex_8_SkColorType;
- }
- break;
- case SkEncodedImageFormat::kWBMP:
- return kIndex_8_SkColorType;
- default:
- break;
- }
-
bool highPrecision = fCodec->getEncodedInfo().bitsPerComponent() > 8;
switch (requestedColorType) {
case kARGB_4444_SkColorType:
return kN32_SkColorType;
case kN32_SkColorType:
- // F16 is the Android default for high precision images.
- return highPrecision ? kRGBA_F16_SkColorType : kN32_SkColorType;
case kIndex_8_SkColorType:
- if (kIndex_8_SkColorType == suggestedColorType) {
- return kIndex_8_SkColorType;
- }
break;
case kAlpha_8_SkColorType:
// Fall through to kGray_8. Before kGray_8_SkColorType existed,
// we allowed clients to request kAlpha_8 when they wanted a
// grayscale decode.
case kGray_8_SkColorType:
- if (kGray_8_SkColorType == suggestedColorType) {
+ if (kGray_8_SkColorType == this->getInfo().colorType()) {
return kGray_8_SkColorType;
}
break;
@@ -152,14 +132,8 @@ 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;
- }
-
- // |suggestedColorType| may be kN32_SkColorType or kIndex_8_SkColorType.
- return highPrecision ? kRGBA_F16_SkColorType : suggestedColorType;
+ // F16 is the Android default for high precision images.
+ return highPrecision ? kRGBA_F16_SkColorType : kN32_SkColorType;
}
SkAlphaType SkAndroidCodec::computeOutputAlphaType(bool requestedUnpremul) {