aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-06-19 07:44:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-19 07:44:05 -0700
commit7054257de9ab53a9daf97e51d5e20178c9604e67 (patch)
treec8dff48330f4d1cc31f79239b86dbf448ed6137f
parenta0c414d7b4d88ed5a1784e4f9fb6ed90905f5247 (diff)
Do not fail on images that are too small to subset decode.
Specifically (0x0) images being produced by webp scaled decodes are causing problems. BUG=skia: Review URL: https://codereview.chromium.org/1192373003
-rw-r--r--dm/DMSrcSink.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 4598a4894b..98f3ba4620 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;