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

Unified Diff: include/codec/SkEncodedInfo.h

Issue 2212563003: Modify SkPngCodec to recognize 565 images from the sBIT chunk (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up test Created 4 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 | src/codec/SkPngCodec.cpp » ('j') | tests/CodecTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkEncodedInfo.h
diff --git a/include/codec/SkEncodedInfo.h b/include/codec/SkEncodedInfo.h
index eb8c147a3b7037ab16a675197bdf9ec7a51ef096..3b6fcbf2dd18915c626054bebc0d94d814132b2e 100644
--- a/include/codec/SkEncodedInfo.h
+++ b/include/codec/SkEncodedInfo.h
@@ -65,6 +65,13 @@ public:
// be treated as inverted CMYK.
kInvertedCMYK_Color,
kYCCK_Color,
+
+ // PNG
+ // 565 images may be encoded to PNG by specifying the number of
+ // significant bits for each channel. This is a strange 565
+ // representation because the image is still encoded with 8 bits per
+ // component.
+ k565_Color,
};
static SkEncodedInfo Make(Color color, Alpha alpha, int bitsPerComponent) {
@@ -105,8 +112,8 @@ public:
SkASSERT(kOpaque_Alpha != alpha);
SkASSERT(8 == bitsPerComponent);
break;
- default:
mtklein 2016/08/04 17:52:51 No need for defaults anymore?
msarett 2016/08/04 19:04:10 Yeah, all values of the enum are handled. This us
- SkASSERT(false);
+ case k565_Color:
+ SkASSERT(kOpaque_Alpha == alpha);
break;
}
@@ -148,9 +155,10 @@ public:
SkASSERT(kOpaque_Alpha != fAlpha);
return SkImageInfo::Make(width, height, kN32_SkColorType,
kUnpremul_SkAlphaType, std::move(colorSpace));
- default:
- SkASSERT(false);
- return SkImageInfo::MakeUnknown();
+ case k565_Color:
+ SkASSERT(kOpaque_Alpha == fAlpha);
+ return SkImageInfo::Make(width, height, kRGB_565_SkColorType,
+ kOpaque_SkAlphaType, std::move(colorSpace));
}
}
@@ -169,6 +177,7 @@ public:
case kRGB_Color:
case kBGR_Color:
case kYUV_Color:
+ case k565_Color:
return 3 * fBitsPerComponent;
case kRGBA_Color:
case kBGRA_Color:
« no previous file with comments | « no previous file | src/codec/SkPngCodec.cpp » ('j') | tests/CodecTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698