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

Unified Diff: src/codec/SkWebpCodec.cpp

Issue 1277893002: Let SkWebpCodec decode to 565 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months 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/SkWebpCodec.cpp
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index fea557d21ed9ddb8e9a86ff475a2c996a8fa749d..041bfb6b63aa191443805a702adc8263ec2e1b3a 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -82,17 +82,23 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
}
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)
+ {
msarett 2015/08/06 19:30:03 nit: I think the bracket should go on the previous
scroggo 2015/08/06 20:42:44 Maybe? In general the { does not get its own line,
+ return true;
+ }
default:
return false;
}
- if (dst.profileType() != src.profileType()) {
- return false;
- }
if (dst.alphaType() == src.alphaType()) {
return true;
}
@@ -115,6 +121,8 @@ static WEBP_CSP_MODE webp_decode_mode(SkColorType ct, bool premultiply) {
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;
}
« 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