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

Issue 1365313002: Merge SkCodec with SkScanlineDecoder (Closed)

Created:
5 years, 2 months ago by scroggo
Modified:
5 years, 2 months ago
Reviewers:
msarett, djsollen
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Merge SkCodec with SkScanlineDecoder Benefits: - This mimics other decoding APIs (including the ones SkCodec relies on, e.g. a png_struct, which can be used to decode an entire image or one line at a time). - It allows a client to ask us to do what we can do efficiently - i.e. start from encoded data and either decode the whole thing or scanlines. - It removes the duplicate methods which appeared in both SkCodec and SkScanlineDecoder (some of which, e.g. in SkJpegScanlineDecoder, just call fCodec->sameMethod()). - It simplifies moving more checks into the base class (e.g. the examples in skbug.com/4284). BUG=skia:4175 BUG=skia:4284 ===================================================================== SkScanlineDecoder.h/.cpp: Removed. SkCodec.h/.cpp: Add methods, enums, and variables which were previously in SkScanlineDecoder. Default fCurrScanline to -1, as a sentinel that start has not been called. General changes: Convert SkScanlineDecoders to SkCodecs. General changes in SkCodec subclasses: Merge SkScanlineDecoder implementation into SkCodec. Most (all?) owned an SkCodec, so they now call this-> instead of fCodec->. SkBmpCodec.h/.cpp: Replace the unused rowOrder method with an override for onGetScanlineOrder. Make getDstRow const, since it is called by onGetY, which is const. SkCodec_libpng.h/.cpp: Make SkPngCodec an abstract class, with two subclasses which handle scanline decoding separately (they share code for decoding the entire image). Reimplement onReallyHasAlpha so that it can return the most recent result (e.g. after a scanline decode which only decoded part of the image) or a better answer (e.g. if the whole image is known to be opaque). Compute fNumberPasses early, so we know which subclass to instantiate. Make SkPngInterlaceScanlineDecoder use the base class' fCurrScanline rather than a separate variable. CodexTest.cpp: Add tests for the state changes in SkCodec (need to call start before decoding scanlines; calling getPixels means that start will need to be called again before decoding more scanlines). Add a test which decodes in stripes, currently only used for an interlaced PNG. TODO: Add tests for onReallyHasAlpha. Committed: https://skia.googlesource.com/skia/+/46c574725676b26ada63ac15e42cda309dcd5090

Patch Set 1 #

Total comments: 38

Patch Set 2 : Cleanups #

Patch Set 3 : Respond to matt's comments in patch set 1 #

Total comments: 8

Patch Set 4 : Respond to derek's comments in patch set 3 #

Total comments: 2

Patch Set 5 : Rebase #

Patch Set 6 : Fix a warning #

Patch Set 7 : Skip ICO in SkScaledCodec for now #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1034 lines, -1133 lines) Patch
M bench/nanobench.cpp View 1 2 3 4 2 chunks +1 line, -4 lines 0 comments Download
M bench/subset/SubsetSingleBench.cpp View 1 2 3 4 2 chunks +5 lines, -7 lines 0 comments Download
M bench/subset/SubsetTranslateBench.cpp View 1 2 3 4 4 chunks +5 lines, -7 lines 0 comments Download
M bench/subset/SubsetZoomBench.cpp View 1 2 3 4 3 chunks +5 lines, -7 lines 0 comments Download
M dm/DM.cpp View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download
M dm/DMSrcSink.cpp View 1 2 3 4 12 chunks +25 lines, -41 lines 0 comments Download
M gyp/codec.gyp View 1 chunk +0 lines, -1 line 0 comments Download
M include/codec/SkCodec.h View 1 2 3 5 chunks +202 lines, -3 lines 0 comments Download
M include/codec/SkScaledCodec.h View 2 chunks +4 lines, -6 lines 0 comments Download
D include/codec/SkScanlineDecoder.h View 1 chunk +0 lines, -288 lines 0 comments Download
A resources/plane_interlaced.png View Binary file 0 comments Download
M src/codec/SkBmpCodec.h View 1 2 3 5 chunks +13 lines, -14 lines 0 comments Download
M src/codec/SkBmpCodec.cpp View 1 2 3 5 chunks +31 lines, -66 lines 0 comments Download
M src/codec/SkBmpMaskCodec.h View 1 chunk +1 line, -1 line 0 comments Download
M src/codec/SkBmpMaskCodec.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/codec/SkBmpRLECodec.h View 1 chunk +1 line, -1 line 0 comments Download
M src/codec/SkBmpRLECodec.cpp View 2 chunks +1 line, -2 lines 0 comments Download
M src/codec/SkBmpStandardCodec.h View 1 chunk +1 line, -1 line 0 comments Download
M src/codec/SkBmpStandardCodec.cpp View 2 chunks +1 line, -2 lines 0 comments Download
M src/codec/SkCodec.cpp View 1 2 3 3 chunks +79 lines, -1 line 0 comments Download
M src/codec/SkCodec_libgif.h View 1 2 3 6 chunks +13 lines, -10 lines 0 comments Download
M src/codec/SkCodec_libgif.cpp View 1 2 3 1 chunk +72 lines, -102 lines 0 comments Download
M src/codec/SkCodec_libpng.h View 1 2 chunks +27 lines, -11 lines 0 comments Download
M src/codec/SkCodec_libpng.cpp View 1 2 3 4 5 13 chunks +189 lines, -131 lines 0 comments Download
M src/codec/SkCodec_wbmp.h View 1 2 3 3 chunks +10 lines, -8 lines 0 comments Download
M src/codec/SkCodec_wbmp.cpp View 1 2 3 3 chunks +42 lines, -75 lines 0 comments Download
M src/codec/SkJpegCodec.h View 1 2 3 4 chunks +14 lines, -11 lines 0 comments Download
M src/codec/SkJpegCodec.cpp View 1 2 3 3 chunks +114 lines, -164 lines 0 comments Download
M src/codec/SkScaledCodec.cpp View 1 2 3 7 chunks +38 lines, -35 lines 0 comments Download
D src/codec/SkScanlineDecoder.cpp View 1 chunk +0 lines, -108 lines 0 comments Download
M tests/CodexTest.cpp View 1 2 3 5 chunks +123 lines, -14 lines 0 comments Download
M tools/SkBitmapRegionCanvas.h View 3 chunks +4 lines, -4 lines 0 comments Download
M tools/SkBitmapRegionCanvas.cpp View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M tools/SkBitmapRegionDecoderInterface.cpp View 1 2 chunks +4 lines, -4 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 27 (12 generated)
scroggo
Please look at patch set 1 (https://codereview.chromium.org/1365313002/#ps1) - I made a bunch of comments there ...
5 years, 2 months ago (2015-09-25 16:07:50 UTC) #2
msarett
I'm really happy with this change - I think it makes life a lot easier. ...
5 years, 2 months ago (2015-09-28 14:48:51 UTC) #3
scroggo
Derek, can you look over the API? https://codereview.chromium.org/1365313002/diff/1/include/codec/SkCodec.h File include/codec/SkCodec.h (right): https://codereview.chromium.org/1365313002/diff/1/include/codec/SkCodec.h#newcode241 include/codec/SkCodec.h:241: * Initialize ...
5 years, 2 months ago (2015-09-28 16:01:53 UTC) #4
djsollen
https://codereview.chromium.org/1365313002/diff/40001/include/codec/SkCodec.h File include/codec/SkCodec.h (right): https://codereview.chromium.org/1365313002/diff/40001/include/codec/SkCodec.h#newcode141 include/codec/SkCodec.h:141: kScanlineDecodingNotStarted, move this above unimplemented. https://codereview.chromium.org/1365313002/diff/40001/include/codec/SkCodec.h#newcode264 include/codec/SkCodec.h:264: Result start(const ...
5 years, 2 months ago (2015-09-29 20:22:17 UTC) #5
scroggo
https://codereview.chromium.org/1365313002/diff/40001/include/codec/SkCodec.h File include/codec/SkCodec.h (right): https://codereview.chromium.org/1365313002/diff/40001/include/codec/SkCodec.h#newcode141 include/codec/SkCodec.h:141: kScanlineDecodingNotStarted, On 2015/09/29 20:22:17, djsollen wrote: > move this ...
5 years, 2 months ago (2015-09-30 13:32:20 UTC) #6
msarett
https://codereview.chromium.org/1365313002/diff/60001/src/codec/SkCodec_libgif.cpp File src/codec/SkCodec_libgif.cpp (right): https://codereview.chromium.org/1365313002/diff/60001/src/codec/SkCodec_libgif.cpp#newcode627 src/codec/SkCodec_libgif.cpp:627: // FIXME: nextScanline is not virtual, so using "INHERITED" ...
5 years, 2 months ago (2015-09-30 13:53:30 UTC) #7
djsollen
api lgtm
5 years, 2 months ago (2015-09-30 15:07:01 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1365313002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1365313002/60001
5 years, 2 months ago (2015-09-30 15:12:02 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: Build-Ubuntu-GCC-Mips-Debug-Android-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-GCC-Mips-Debug-Android-Trybot/builds/2716) Build-Ubuntu-GCC-x86_64-Release-Trybot on client.skia.compile (JOB_FAILED, ...
5 years, 2 months ago (2015-09-30 15:12:49 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1365313002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1365313002/80001
5 years, 2 months ago (2015-09-30 15:22:14 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: Build-Win-MSVC-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Win-MSVC-x86_64-Debug-Trybot/builds/3532)
5 years, 2 months ago (2015-09-30 15:24:06 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1365313002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1365313002/100001
5 years, 2 months ago (2015-09-30 15:28:50 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/3418)
5 years, 2 months ago (2015-09-30 15:32:02 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1365313002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1365313002/120001
5 years, 2 months ago (2015-09-30 15:49:05 UTC) #26
commit-bot: I haz the power
5 years, 2 months ago (2015-09-30 15:57:20 UTC) #27
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as
https://skia.googlesource.com/skia/+/46c574725676b26ada63ac15e42cda309dcd5090

Powered by Google App Engine
This is Rietveld 408576698