diff options
author | msarett <msarett@google.com> | 2015-10-09 11:07:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-09 11:07:34 -0700 |
commit | e6dd004c1b8a81dc37a370570877b8b7d6dbe308 (patch) | |
tree | 16ecfdede3939dcd7f1b3db311371d974477e7c5 /tools | |
parent | 79da63fa0bec40b560597c79c2e1231fa51aef36 (diff) |
Fill incomplete images in SkCodec parent class
Rather than implementing some sort of "fill" in every
SkCodec subclass for incomplete images, let's make the
parent class handle this situation.
This includes an API change to SkCodec.h
SkCodec::getScanlines() now returns the number of lines it
read successfully, rather than an SkCodec::Result enum.
getScanlines() most often fails on an incomplete input, in
which case it is useful to know how many lines were
successfully decoded - this provides more information than
kIncomplete vs kSuccess. We do lose information when the
API is used improperly, as we are no longer able to return
kInvalidParameter or kScanlineNotStarted.
Known Issues:
Does not work for incomplete fFrameIsSubset gifs.
Does not work for incomplete icos.
BUG=skia:
Review URL: https://codereview.chromium.org/1332053002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/SkBitmapRegionCanvas.cpp | 13 | ||||
-rw-r--r-- | tools/SkBitmapRegionDecoderInterface.cpp | 8 | ||||
-rw-r--r-- | tools/dm_flags.json | 760 | ||||
-rwxr-xr-x | tools/dm_flags.py | 21 |
4 files changed, 787 insertions, 15 deletions
diff --git a/tools/SkBitmapRegionCanvas.cpp b/tools/SkBitmapRegionCanvas.cpp index c54d936edc..086ac19864 100644 --- a/tools/SkBitmapRegionCanvas.cpp +++ b/tools/SkBitmapRegionCanvas.cpp @@ -128,22 +128,13 @@ SkBitmap* SkBitmapRegionCanvas::decodeRegion(int inputX, int inputY, } // Skip the unneeded rows - if (SkCodec::kSuccess != fDecoder->skipScanlines(imageSubsetY)) { + if (!fDecoder->skipScanlines(imageSubsetY)) { SkDebugf("Error: Failed to skip scanlines.\n"); return nullptr; } // Decode the necessary rows - SkCodec::Result result = fDecoder->getScanlines(tmp.getAddr(0, 0), imageSubsetHeight, - tmp.rowBytes()); - switch (result) { - case SkCodec::kSuccess: - case SkCodec::kIncompleteInput: - break; - default: - SkDebugf("Error: Failed to get scanlines.\n"); - return nullptr; - } + fDecoder->getScanlines(tmp.getAddr(0, 0), imageSubsetHeight, tmp.rowBytes()); // Calculate the size of the output const int outWidth = get_scaled_dimension(inputWidth, sampleSize); diff --git a/tools/SkBitmapRegionDecoderInterface.cpp b/tools/SkBitmapRegionDecoderInterface.cpp index 5c769d676e..47de31f4ec 100644 --- a/tools/SkBitmapRegionDecoderInterface.cpp +++ b/tools/SkBitmapRegionDecoderInterface.cpp @@ -29,12 +29,12 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi return new SkBitmapRegionSampler(decoder, width, height); } case kCanvas_Strategy: { - SkCodec* decoder = SkCodec::NewFromStream(stream); - if (nullptr == decoder) { + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream)); + if (nullptr == codec) { SkDebugf("Error: Failed to create decoder.\n"); return nullptr; } - switch (decoder->getScanlineOrder()) { + switch (codec->getScanlineOrder()) { case SkCodec::kTopDown_SkScanlineOrder: case SkCodec::kNone_SkScanlineOrder: break; @@ -42,7 +42,7 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi SkDebugf("Error: Scanline ordering not supported.\n"); return nullptr; } - return new SkBitmapRegionCanvas(decoder); + return new SkBitmapRegionCanvas(codec.detach()); } default: SkASSERT(false); diff --git a/tools/dm_flags.json b/tools/dm_flags.json index 5dc0b5295e..11baa6d469 100644 --- a/tools/dm_flags.json +++ b/tools/dm_flags.json @@ -125,6 +125,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "gpu", "skp", "_", @@ -275,6 +351,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "--match", "~WritePixels", "~tabl_mozilla_0", @@ -398,6 +550,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "--match", "~tabl_mozilla_0", "~desk_yahoonews_0", @@ -523,6 +751,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "--match", "~tabl_mozilla_0", "~desk_yahoonews_0" @@ -645,6 +949,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "--match", "~tabl_mozilla_0", "~desk_yahoonews_0" @@ -765,6 +1145,82 @@ "Hopstarter-Mac-Folders-Apple.ico", "_", "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", + "_", + "image", "_", "interlaced1.png", "_", @@ -910,6 +1366,82 @@ "Hopstarter-Mac-Folders-Apple.ico", "_", "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", + "_", + "image", "_", "interlaced1.png", "_", @@ -1051,6 +1583,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "pdf", "_", "_", @@ -1217,6 +1825,82 @@ "image", "decode", "Hopstarter-Mac-Folders-Apple.ico", + "_", + "image", + "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", "pdf", "_", "_", @@ -1386,6 +2070,82 @@ "_", "image", "decode", + "inc0.gif", + "_", + "image", + "decode", + "inc1.gif", + "_", + "image", + "decode", + "incInterlaced.gif", + "_", + "image", + "decode", + "inc0.jpg", + "_", + "image", + "decode", + "incGray.jpg", + "_", + "image", + "decode", + "inc0.wbmp", + "_", + "image", + "decode", + "inc1.wbmp", + "_", + "image", + "decode", + "inc0.webp", + "_", + "image", + "decode", + "inc1.webp", + "_", + "image", + "decode", + "inc0.ico", + "_", + "image", + "decode", + "inc1.ico", + "_", + "image", + "decode", + "inc0.png", + "_", + "image", + "decode", + "inc1.png", + "_", + "image", + "decode", + "inc2.png", + "_", + "image", + "decode", + "inc12.png", + "_", + "image", + "decode", + "inc13.png", + "_", + "image", + "decode", + "inc14.png", + "_", + "image", + "subset", + "inc0.webp", + "_", + "image", + "subset", + "inc1.webp", + "_", + "image", + "decode", "_", "_", "image", diff --git a/tools/dm_flags.py b/tools/dm_flags.py index 64b4cec93e..e8f39182fd 100755 --- a/tools/dm_flags.py +++ b/tools/dm_flags.py @@ -112,6 +112,27 @@ def get_args(bot): # New ico files that fail on SkImageDecoder blacklist.extend('_ image decode Hopstarter-Mac-Folders-Apple.ico'.split(' ')) + # Incomplete image tests that fail on SkImageDecoder + blacklist.extend('_ image decode inc0.gif'.split(' ')) + blacklist.extend('_ image decode inc1.gif'.split(' ')) + blacklist.extend('_ image decode incInterlaced.gif'.split(' ')) + blacklist.extend('_ image decode inc0.jpg'.split(' ')) + blacklist.extend('_ image decode incGray.jpg'.split(' ')) + blacklist.extend('_ image decode inc0.wbmp'.split(' ')) + blacklist.extend('_ image decode inc1.wbmp'.split(' ')) + blacklist.extend('_ image decode inc0.webp'.split(' ')) + blacklist.extend('_ image decode inc1.webp'.split(' ')) + blacklist.extend('_ image decode inc0.ico'.split(' ')) + blacklist.extend('_ image decode inc1.ico'.split(' ')) + blacklist.extend('_ image decode inc0.png'.split(' ')) + blacklist.extend('_ image decode inc1.png'.split(' ')) + blacklist.extend('_ image decode inc2.png'.split(' ')) + blacklist.extend('_ image decode inc12.png'.split(' ')) + blacklist.extend('_ image decode inc13.png'.split(' ')) + blacklist.extend('_ image decode inc14.png'.split(' ')) + blacklist.extend('_ image subset inc0.webp'.split(' ')) + blacklist.extend('_ image subset inc1.webp'.split(' ')) + # Leon doesn't care about this, so why run it? if 'Win' in bot: blacklist.extend('_ image decode _'.split(' ')) |