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

Unified Diff: dm/DMSrcSink.cpp

Issue 1076923002: SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-real
Patch Set: SkJpegCodec Created 5 years, 8 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
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 9e9a77c27124e85350406c7e84ec3b2f8f5f0886..183375c7fcc2bea641183822708d5b2c6a29bdc1 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -80,7 +80,17 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
SkColorType canvasColorType = canvasInfo.colorType();
switch (fDstColorType) {
case kIndex8_Always_DstColorType:
+ if (kIndex_8_SkColorType != decodeInfo.colorType()) {
scroggo 2015/04/10 17:19:05 I'd prefer just setting decodeInfo to use kIndex8,
msarett 2015/04/13 20:54:04 Completely agree. See my comment in DM.cpp.
+ return Error::Nonfatal("Cannot decode to kIndex8.");
+ }
+ if (kRGB_565_SkColorType == canvasColorType) {
+ return Error::Nonfatal("Testing non-565 to 565 is uninteresting.");
+ }
+ break;
case kGrayscale_Always_DstColorType:
+ if (kGray_8_SkColorType != decodeInfo.colorType()) {
+ return Error::Nonfatal("Cannot decode to kGray8.");
+ }
if (kRGB_565_SkColorType == canvasColorType) {
return Error::Nonfatal("Testing non-565 to 565 is uninteresting.");
}

Powered by Google App Engine
This is Rietveld 408576698