aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkWbmpCodec.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@chromium.org>2016-05-20 13:56:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-20 13:56:13 -0700
commitba5848953e00685f9a57343aef94372c5803130a (patch)
treed649d222b437821786d485abd515a81963c1b265 /src/codec/SkWbmpCodec.cpp
parent17b4a109219d063dc10a988b1ed46aaefe278477 (diff)
Finish supporting decoding opaque to non-opaque
When decoding to 565 or Gray, allow the client to incorrectly ask for premul. When checking whether it's possible to decode to 565, return whether the source is opaque. In DM, allow decoding to 565 or Gray, even if the client also asked for premul. This fixes a bug introduced in crrev.com/1999593003 when we stopped ever requesting Opaque, resulting in us not testing 565 or Gray. BUG=skia:4616 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=1996993003 Review-Url: https://codereview.chromium.org/1996993003
Diffstat (limited to 'src/codec/SkWbmpCodec.cpp')
-rw-r--r--src/codec/SkWbmpCodec.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 527565f6ab..326fc2206a 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -30,15 +30,14 @@ static inline void setup_color_table(SkColorType colorType,
}
}
-static inline bool valid_color_type(SkColorType colorType, SkAlphaType alphaType) {
+static inline bool valid_color_type(SkColorType colorType) {
switch (colorType) {
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:
case kIndex_8_SkColorType:
- return true;
case kGray_8_SkColorType:
case kRGB_565_SkColorType:
- return kOpaque_SkAlphaType == alphaType;
+ return true;
default:
return false;
}
@@ -128,7 +127,7 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
return kUnimplemented;
}
- if (!valid_color_type(info.colorType(), info.alphaType()) ||
+ if (!valid_color_type(info.colorType()) ||
!valid_alpha(info.alphaType(), this->getInfo().alphaType())) {
return kInvalidConversion;
}
@@ -196,7 +195,7 @@ SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
return kUnimplemented;
}
- if (!valid_color_type(dstInfo.colorType(), dstInfo.alphaType()) ||
+ if (!valid_color_type(dstInfo.colorType()) ||
!valid_alpha(dstInfo.alphaType(), this->getInfo().alphaType())) {
return kInvalidConversion;
}