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

Unified Diff: dm/DMSrcSink.cpp

Issue 1192373003: Do not fail on images that are too small to subset decode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 4598a4894b7956ed681d6b199b569ee58572bf12..98f3ba46209a1b90529875b9c5d47b76447b269b 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -182,12 +182,9 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
const int divisor = 2;
const int w = decodeInfo.width();
const int h = decodeInfo.height();
- if (w*h == 1) {
- return Error::Nonfatal("Subset decoding not supported.");
- }
if (divisor > w || divisor > h) {
- return SkStringPrintf("divisor %d is too big for %s with dimensions (%d x %d)",
- divisor, fPath.c_str(), w, h);
+ return Error::Nonfatal(SkStringPrintf("Cannot decode subset: divisor %d is too big"
+ "for %s with dimensions (%d x %d)", divisor, fPath.c_str(), w, h));
}
const int subsetWidth = w/divisor;
const int subsetHeight = h/divisor;
@@ -407,14 +404,14 @@ Error ImageSrc::draw(SkCanvas* canvas) const {
}
stream->rewind();
int w,h;
- if (!decoder->buildTileIndex(stream.detach(), &w, &h) || w*h == 1) {
+ if (!decoder->buildTileIndex(stream.detach(), &w, &h)) {
return Error::Nonfatal("Subset decoding not supported.");
}
// Divide the image into subsets that cover the entire image.
if (fDivisor > w || fDivisor > h) {
- return SkStringPrintf("divisor %d is too big for %s with dimensions (%d x %d)",
- fDivisor, fPath.c_str(), w, h);
+ return Error::Nonfatal(SkStringPrintf("Cannot decode subset: divisor %d is too big"
+ "for %s with dimensions (%d x %d)", fDivisor, fPath.c_str(), w, h));
}
const int subsetWidth = w / fDivisor,
subsetHeight = h / fDivisor;
« 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