Let SkWebpCodec decode to 565
BUG=skia:3257
Review URL: https://codereview.chromium.org/1277893002
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index fea557d..041bfb6 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -82,17 +82,23 @@
}
static bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) {
+ if (dst.profileType() != src.profileType()) {
+ return false;
+ }
switch (dst.colorType()) {
// Both byte orders are supported.
case kBGRA_8888_SkColorType:
case kRGBA_8888_SkColorType:
break;
+ case kRGB_565_SkColorType:
+ if (src.alphaType() == kOpaque_SkAlphaType
+ && dst.alphaType() == kOpaque_SkAlphaType)
+ {
+ return true;
+ }
default:
return false;
}
- if (dst.profileType() != src.profileType()) {
- return false;
- }
if (dst.alphaType() == src.alphaType()) {
return true;
}
@@ -115,6 +121,8 @@
return premultiply ? MODE_bgrA : MODE_BGRA;
case kRGBA_8888_SkColorType:
return premultiply ? MODE_rgbA : MODE_RGBA;
+ case kRGB_565_SkColorType:
+ return MODE_RGB_565;
default:
return MODE_LAST;
}