diff options
author | msarett <msarett@google.com> | 2016-02-11 13:29:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-11 13:29:36 -0800 |
commit | 9b9497ef14f23562a95afe989d1efe41c603a6f6 (patch) | |
tree | 73bcf52cd5174899c13c816d02092faccdc8453d /src/codec/SkBmpRLECodec.cpp | |
parent | f8289d9bd1faff400728cb8e1ac0b1aa68bfbc32 (diff) |
Implement onSkipScanlines() for bmp and wbmp
TBR=reed@google.com
BUG=skia:4270
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1691083002
Review URL: https://codereview.chromium.org/1691083002
Diffstat (limited to 'src/codec/SkBmpRLECodec.cpp')
-rw-r--r-- | src/codec/SkBmpRLECodec.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp index 05691cc079..1b95acc830 100644 --- a/src/codec/SkBmpRLECodec.cpp +++ b/src/codec/SkBmpRLECodec.cpp @@ -201,7 +201,7 @@ size_t SkBmpRLECodec::checkForMoreData() { void SkBmpRLECodec::setPixel(void* dst, size_t dstRowBytes, const SkImageInfo& dstInfo, uint32_t x, uint32_t y, uint8_t index) { - if (is_coord_necessary(x, fSampleX, dstInfo.width())) { + if (dst && is_coord_necessary(x, fSampleX, dstInfo.width())) { // Set the row uint32_t row = this->getDstRow(y, dstInfo.height()); @@ -234,7 +234,7 @@ void SkBmpRLECodec::setRGBPixel(void* dst, size_t dstRowBytes, const SkImageInfo& dstInfo, uint32_t x, uint32_t y, uint8_t red, uint8_t green, uint8_t blue) { - if (is_coord_necessary(x, fSampleX, dstInfo.width())) { + if (dst && is_coord_necessary(x, fSampleX, dstInfo.width())) { // Set the row uint32_t row = this->getDstRow(y, dstInfo.height()); @@ -316,7 +316,9 @@ int SkBmpRLECodec::decodeRows(const SkImageInfo& info, void* dst, size_t dstRowB // Because of the need for transparent pixels, kN32 is the only color // type that makes sense for the destination format. SkASSERT(kN32_SkColorType == dstInfo.colorType()); - SkSampler::Fill(dstInfo, dst, dstRowBytes, SK_ColorTRANSPARENT, opts.fZeroInitialized); + if (dst) { + SkSampler::Fill(dstInfo, dst, dstRowBytes, SK_ColorTRANSPARENT, opts.fZeroInitialized); + } // Adjust the height and the dst if the previous call to decodeRows() left us // with lines that need to be skipped. @@ -500,6 +502,13 @@ int SkBmpRLECodec::decodeRows(const SkImageInfo& info, void* dst, size_t dstRowB } } +bool SkBmpRLECodec::skipRows(int count) { + const SkImageInfo rowInfo = SkImageInfo::Make(this->getInfo().width(), count, kN32_SkColorType, + kUnpremul_SkAlphaType); + + return count == this->decodeRows(rowInfo, nullptr, 0, this->options()); +} + // FIXME: Make SkBmpRLECodec have no knowledge of sampling. // Or it should do all sampling natively. // It currently is a hybrid that needs to know what SkScaledCodec is doing. |