aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkWbmpCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2017-07-11 17:35:31 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-11 18:00:31 +0000
commit571b30f6117eede6d64cd2b924dc1f6aaa59e70e (patch)
treea617b52ab7728fc7b2324fef75a0775438d94d71 /src/codec/SkWbmpCodec.cpp
parentf778eb2f51572d57a75e1a9cec25d5495f6662e1 (diff)
Reland "Remove support for decoding to kIndex_8"
Original change's description: > > Remove support for decoding to kIndex_8 > > > > Fix up callsites, and remove tests that no longer make sense. > > > > Bug: skia:6828 > > Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295 > > Reviewed-on: https://skia-review.googlesource.com/21664 > > Reviewed-by: Derek Sollenberger <djsollen@google.com> > > Commit-Queue: Leon Scroggins <scroggo@google.com> > > TBR=djsollen@google.com,scroggo@google.com > > Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:6828 > Reviewed-on: https://skia-review.googlesource.com/22120 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=djsollen@google.com,scroggo@google.com Bug: skia:6828 Change-Id: I36ff5a11c529d29e8adc95f43b8edc6fd1dbf5b8 Reviewed-on: https://skia-review.googlesource.com/22320 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkWbmpCodec.cpp')
-rw-r--r--src/codec/SkWbmpCodec.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 780ae5e5d0..fe9a29133e 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -21,15 +21,6 @@ static inline size_t get_src_row_bytes(int width) {
return SkAlign8(width) >> 3;
}
-static inline void setup_color_table(SkColorType colorType,
- SkPMColor* colorPtr, int* colorCount) {
- if (kIndex_8_SkColorType == colorType) {
- colorPtr[0] = SK_ColorBLACK;
- colorPtr[1] = SK_ColorWHITE;
- *colorCount = 2;
- }
-}
-
static inline bool valid_color_type(const SkImageInfo& dstInfo) {
switch (dstInfo.colorType()) {
case kRGBA_8888_SkColorType:
@@ -97,9 +88,8 @@ bool SkWbmpCodec::onRewind() {
return read_header(this->stream(), nullptr);
}
-SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, const SkPMColor* ctable,
- const Options& opts) {
- return SkSwizzler::CreateSwizzler(this->getEncodedInfo(), ctable, info, opts);
+SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, const Options& opts) {
+ return SkSwizzler::CreateSwizzler(this->getEncodedInfo(), nullptr, info, opts);
}
bool SkWbmpCodec::readRow(uint8_t* row) {
@@ -112,7 +102,6 @@ SkWbmpCodec::SkWbmpCodec(int width, int height, const SkEncodedInfo& info, SkStr
stream, SkColorSpace::MakeSRGB())
, fSrcRowBytes(get_src_row_bytes(this->getInfo().width()))
, fSwizzler(nullptr)
- , fColorTable(nullptr)
{}
SkEncodedImageFormat SkWbmpCodec::onGetEncodedFormat() const {
@@ -123,8 +112,6 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
void* dst,
size_t rowBytes,
const Options& options,
- SkPMColor ctable[],
- int* ctableCount,
int* rowsDecoded) {
if (options.fSubset) {
// Subsets are not supported.
@@ -135,11 +122,8 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
return kInvalidConversion;
}
- // Prepare a color table if necessary
- setup_color_table(info.colorType(), ctable, ctableCount);
-
// Initialize the swizzler
- std::unique_ptr<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
+ std::unique_ptr<SkSwizzler> swizzler(this->initializeSwizzler(info, options));
SkASSERT(swizzler);
// Perform the decode
@@ -191,7 +175,7 @@ bool SkWbmpCodec::onSkipScanlines(int count) {
}
SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
- const Options& options, SkPMColor inputColorTable[], int* inputColorCount) {
+ const Options& options) {
if (options.fSubset) {
// Subsets are not supported.
return kUnimplemented;
@@ -203,16 +187,8 @@ SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
return kInvalidConversion;
}
- // Fill in the color table
- setup_color_table(dstInfo.colorType(), inputColorTable, inputColorCount);
-
- // Copy the color table to a pointer that can be owned by the scanline decoder
- if (kIndex_8_SkColorType == dstInfo.colorType()) {
- fColorTable.reset(new SkColorTable(inputColorTable, 2));
- }
-
// Initialize the swizzler
- fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.get()), options));
+ fSwizzler.reset(this->initializeSwizzler(dstInfo, options));
SkASSERT(fSwizzler);
fSrcBuffer.reset(fSrcRowBytes);