aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngCodec.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/SkPngCodec.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/SkPngCodec.cpp')
-rw-r--r--src/codec/SkPngCodec.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index d77fe4007d..ea832ff688 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -245,7 +245,7 @@ void SkPngCodec::processData() {
static const SkColorType kXformSrcColorType = kRGBA_8888_SkColorType;
// Note: SkColorTable claims to store SkPMColors, which is not necessarily the case here.
-bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount) {
+bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo) {
int numColors;
png_color* palette;
@@ -308,11 +308,6 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
sk_memset32(colorTable + numColors, lastColor, maxColors - numColors);
}
- // Set the new color count.
- if (ctableCount != nullptr) {
- *ctableCount = maxColors;
- }
-
fColorTable.reset(new SkColorTable(colorTable, maxColors));
return true;
}
@@ -973,8 +968,7 @@ void SkPngCodec::destroyReadStruct() {
// Getting the pixels
///////////////////////////////////////////////////////////////////////////////
-SkCodec::Result SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const Options& options,
- SkPMColor ctable[], int* ctableCount) {
+SkCodec::Result SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const Options& options) {
if (setjmp(PNG_JMPBUF((png_struct*)fPng_ptr))) {
SkCodecPrintf("Failed on png_read_update_info.\n");
return kInvalidInput;
@@ -1011,14 +1005,11 @@ SkCodec::Result SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const O
}
if (SkEncodedInfo::kPalette_Color == this->getEncodedInfo().color()) {
- if (!this->createColorTable(dstInfo, ctableCount)) {
+ if (!this->createColorTable(dstInfo)) {
return kInvalidInput;
}
}
- // Copy the color table to the client if they request kIndex8 mode.
- copy_color_table(dstInfo, fColorTable.get(), ctable, ctableCount);
-
this->initializeSwizzler(dstInfo, options, skipFormatConversion);
return kSuccess;
}
@@ -1092,13 +1083,12 @@ bool SkPngCodec::onRewind() {
SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
size_t rowBytes, const Options& options,
- SkPMColor ctable[], int* ctableCount,
int* rowsDecoded) {
if (!conversion_possible(dstInfo, this->getInfo())) {
return kInvalidConversion;
}
- Result result = this->initializeXforms(dstInfo, options, ctable, ctableCount);
+ Result result = this->initializeXforms(dstInfo, options);
if (kSuccess != result) {
return result;
}
@@ -1113,13 +1103,12 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
}
SkCodec::Result SkPngCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo,
- void* dst, size_t rowBytes, const SkCodec::Options& options,
- SkPMColor* ctable, int* ctableCount) {
+ void* dst, size_t rowBytes, const SkCodec::Options& options) {
if (!conversion_possible(dstInfo, this->getInfo())) {
return kInvalidConversion;
}
- Result result = this->initializeXforms(dstInfo, options, ctable, ctableCount);
+ Result result = this->initializeXforms(dstInfo, options);
if (kSuccess != result) {
return result;
}