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

Unified Diff: dm/DMSrcSink.cpp

Issue 1704433003: Make kInvalidConversion a fatal failure in DMSrcSink (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Third time is the charm Created 4 years, 10 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 | « dm/DM.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 0e2d307264eebe78a97db215efc1ef88c3b52e2e..e5d18cdaafd86af6d66ff5f3b4660619b64cc933 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -321,12 +321,17 @@ bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType,
*decodeInfo = decodeInfo->makeColorType(kIndex_8_SkColorType);
break;
case CodecSrc::kGrayscale_Always_DstColorType:
- if (kRGB_565_SkColorType == canvasColorType) {
+ if (kRGB_565_SkColorType == canvasColorType ||
+ kOpaque_SkAlphaType != decodeInfo->alphaType()) {
scroggo 2016/02/16 21:13:25 We only attempt gray if the codec reports it as th
msarett 2016/02/16 21:14:51 It gets hit because we now test kOpaque images to
return false;
}
*decodeInfo = decodeInfo->makeColorType(kGray_8_SkColorType);
break;
default:
+ if (kRGB_565_SkColorType == canvasColorType &&
+ kOpaque_SkAlphaType != decodeInfo->alphaType()) {
+ return false;
+ }
*decodeInfo = decodeInfo->makeColorType(canvasColorType);
break;
}
@@ -428,8 +433,6 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
// available.
case SkCodec::kIncompleteInput:
break;
- case SkCodec::kInvalidConversion:
- return Error::Nonfatal("Incompatible colortype conversion");
default:
// Everything else is considered a failure.
return SkStringPrintf("Couldn't getPixels %s.", fPath.c_str());
@@ -700,8 +703,6 @@ Error AndroidCodecSrc::draw(SkCanvas* canvas) const {
case SkCodec::kSuccess:
case SkCodec::kIncompleteInput:
break;
- case SkCodec::kInvalidConversion:
- return Error::Nonfatal("Cannot convert to requested color type.");
default:
return SkStringPrintf("Couldn't getPixels %s.", fPath.c_str());
}
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698