diff options
author | 2016-02-11 13:29:36 -0800 | |
---|---|---|
committer | 2016-02-11 13:29:36 -0800 | |
commit | 9b9497ef14f23562a95afe989d1efe41c603a6f6 (patch) | |
tree | 73bcf52cd5174899c13c816d02092faccdc8453d /src/codec/SkBmpCodec.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/SkBmpCodec.cpp')
-rw-r--r-- | src/codec/SkBmpCodec.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp index cbba28c172..babb17d32e 100644 --- a/src/codec/SkBmpCodec.cpp +++ b/src/codec/SkBmpCodec.cpp @@ -546,6 +546,7 @@ SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream, : INHERITED(info, stream) , fBitsPerPixel(bitsPerPixel) , fRowOrder(rowOrder) + , fSrcRowBytes(SkAlign4(compute_row_bytes(info.width(), fBitsPerPixel))) {} bool SkBmpCodec::onRewind() { @@ -577,3 +578,12 @@ int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { // Decode the requested rows return this->decodeRows(rowInfo, dst, rowBytes, this->options()); } + +bool SkBmpCodec::skipRows(int count) { + const size_t bytesToSkip = count * fSrcRowBytes; + return this->stream()->skip(bytesToSkip) == bytesToSkip; +} + +bool SkBmpCodec::onSkipScanlines(int count) { + return this->skipRows(count); +} |