diff options
author | 2013-05-03 20:14:28 +0000 | |
---|---|---|
committer | 2013-05-03 20:14:28 +0000 | |
commit | 7e6fceeffd250d99eff9f1dbb459a916ae4a754e (patch) | |
tree | 12bd9ee920cd58a8a31b9aff4abde0429a95a372 /src/images/SkImageDecoder_libwebp.cpp | |
parent | dc9cdf8d49ecfe174c408845b7f2de6f5a756b1d (diff) |
Test region decoding in skimage, plus fixes.
Add tests in skimage to perform region decoding. Write out a
PNG of the region as well as a bitmap obtained with extractSubset
for comparison.
Rename decodeRegion to decodeSubset, so it will not be confused
with SkRegion. (Leave a function called decodeRegion which calls
decodeSubset.)
Clean up some comments.
Use png_set_interlaced_pass instead of modifying pass directly.
Make some changes to region decoding to fix problems I discovered
during testing:
Only call getAddr within a valid range.
Check for a NULL fInputStream.
Return a boolean for whether cropBitmap succeeded.
In cropBitmap, do not attempt to draw to a bitmap to an Index8
bitmap, which crashes. Use extractSubset instead.
Remove an assert.
R=djsollen@google.com
Review URL: https://codereview.chromium.org/14567011
git-svn-id: http://skia.googlecode.com/svn/trunk@8996 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images/SkImageDecoder_libwebp.cpp')
-rw-r--r-- | src/images/SkImageDecoder_libwebp.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp index a33d0f9b2f..e623f376d7 100644 --- a/src/images/SkImageDecoder_libwebp.cpp +++ b/src/images/SkImageDecoder_libwebp.cpp @@ -111,7 +111,7 @@ public: protected: virtual bool onBuildTileIndex(SkStream *stream, int *width, int *height) SK_OVERRIDE; - virtual bool onDecodeRegion(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE; + virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE; virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; private: @@ -321,7 +321,7 @@ static bool is_config_compatible(const SkBitmap& bitmap) { config == SkBitmap::kARGB_8888_Config; } -bool SkWEBPImageDecoder::onDecodeRegion(SkBitmap* decodedBitmap, +bool SkWEBPImageDecoder::onDecodeSubset(SkBitmap* decodedBitmap, const SkIRect& region) { SkIRect rect = SkIRect::MakeWH(fOrigWidth, fOrigHeight); |