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>
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 780ae5e..fe9a291 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -21,15 +21,6 @@
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 @@
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 @@
stream, SkColorSpace::MakeSRGB())
, fSrcRowBytes(get_src_row_bytes(this->getInfo().width()))
, fSwizzler(nullptr)
- , fColorTable(nullptr)
{}
SkEncodedImageFormat SkWbmpCodec::onGetEncodedFormat() const {
@@ -123,8 +112,6 @@
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 @@
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 @@
}
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 @@
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);