diff options
author | scroggo <scroggo@google.com> | 2015-10-02 13:14:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-02 13:14:46 -0700 |
commit | e7fc14b55bb8c41ba054abf0bfa09cdd6ec84671 (patch) | |
tree | 81525743c2c436a60f4127cf04f0f96d5dc3bed5 /src/codec/SkCodec_wbmp.cpp | |
parent | 65f7c9fa7ed028159a4a2c792ccc1dcdf718eed2 (diff) |
Move all knowledge of X sampling into SkScaledCodec
Prior to this CL, each SkCodec subclass that allows sampling does an
extra check in onStartScanlineDecode to determine whether the X dimension
is supported for sampling. Remove this check, and provide a way for
SkScaledCodec to directly access the SkSwizzler, and update it to do
sampling. This way, the SkCodec knows nothing of sampling, but we can
still save the extra step of sampling afterwards.
FIXME: SkBmpRLECodec still calls SkScaledCodec::DimensionsSupported. It
seems like it could directly support sampling, rather than dealing with
SkScaledCodec (partially).
Add a new base class for SkSwizzler. It allows updating the swizzler
after it was created, which is done by SkScaledCodec. Modify SkSwizzler's
constructor/factory function to stop taking any info about sampling,
assume the sample size is one, and move modifying that into a virtual
function overridden from the base class.
BUG=skia:4284
Review URL: https://codereview.chromium.org/1372973002
Diffstat (limited to 'src/codec/SkCodec_wbmp.cpp')
-rw-r--r-- | src/codec/SkCodec_wbmp.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp index 1696dfb585..d7f446bb57 100644 --- a/src/codec/SkCodec_wbmp.cpp +++ b/src/codec/SkCodec_wbmp.cpp @@ -9,7 +9,6 @@ #include "SkCodecPriv.h" #include "SkColorPriv.h" #include "SkColorTable.h" -#include "SkScaledCodec.h" #include "SkStream.h" #include "SkCodec_wbmp.h" @@ -79,11 +78,12 @@ SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, case kN32_SkColorType: case kRGB_565_SkColorType: case kGray_8_SkColorType: - return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized, - this->getInfo()); + break; default: return nullptr; } + return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, + opts.fZeroInitialized); } SkCodec::Result SkWbmpCodec::readRow(uint8_t* row) { @@ -114,9 +114,6 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info, // Subsets are not supported. return kUnimplemented; } - if (info.dimensions() != this->getInfo().dimensions()) { - return kInvalidScale; - } if (!valid_alpha(info.alphaType(), this->getInfo().alphaType())) { return kInvalidConversion; @@ -125,7 +122,6 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info, // Prepare a color table if necessary setup_color_table(info.colorType(), ctable, ctableCount); - // Initialize the swizzler SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options)); if (nullptr == swizzler.get()) { @@ -181,11 +177,6 @@ SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, // Subsets are not supported. return kUnimplemented; } - if (dstInfo.dimensions() != this->getInfo().dimensions()) { - if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstInfo)) { - return kInvalidScale; - } - } if (!valid_alpha(dstInfo.alphaType(), this->getInfo().alphaType())) { return kInvalidConversion; |