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 /src/codec/SkMaskSwizzler.h | |
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 'src/codec/SkMaskSwizzler.h')
-rw-r--r-- | src/codec/SkMaskSwizzler.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/codec/SkMaskSwizzler.h b/src/codec/SkMaskSwizzler.h index fbc951a070..0513d838c7 100644 --- a/src/codec/SkMaskSwizzler.h +++ b/src/codec/SkMaskSwizzler.h @@ -35,6 +35,15 @@ public: */ SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); + /** + * Implement fill using a custom width. + */ + void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colorOrIndex, + SkCodec::ZeroInitialized zeroInit) override { + const SkImageInfo fillInfo = info.makeWH(fDstWidth, info.height()); + SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); + } + private: /* |