aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-07-10 11:51:37 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-10 17:06:48 +0000
commit742a3e298fda669006147e4a305bab8452369b1f (patch)
tree6b5ceb03ecdfbc3f3e86f16357207a67e82acb99 /src/codec/SkCodec.cpp
parentda1893fe3a654b551516ce706a363eebf8471511 (diff)
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>
Diffstat (limited to 'src/codec/SkCodec.cpp')
-rw-r--r--src/codec/SkCodec.cpp61
1 files changed, 8 insertions, 53 deletions
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 26b31ae11f..4bd3917880 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -167,19 +167,6 @@ bool SkCodec::rewindIfNeeded() {
return this->onRewind();
}
-#define CHECK_COLOR_TABLE \
- if (kIndex_8_SkColorType == info.colorType()) { \
- if (nullptr == ctable || nullptr == ctableCount) { \
- return SkCodec::kInvalidParameters; \
- } \
- } else { \
- if (ctableCount) { \
- *ctableCount = 0; \
- } \
- ctableCount = nullptr; \
- ctable = nullptr; \
- }
-
static void zero_rect(const SkImageInfo& dstInfo, void* pixels, size_t rowBytes,
SkIRect frameRect) {
if (!frameRect.intersect(dstInfo.bounds())) {
@@ -205,11 +192,6 @@ SkCodec::Result SkCodec::handleFrameIndex(const SkImageInfo& info, void* pixels,
return kInvalidParameters;
}
- // index 8 is not supported beyond the first frame.
- if (index < 0 || info.colorType() == kIndex_8_SkColorType) {
- return kInvalidParameters;
- }
-
if (index >= this->onGetFrameCount()) {
return kIncompleteInput;
}
@@ -252,8 +234,7 @@ SkCodec::Result SkCodec::handleFrameIndex(const SkImageInfo& info, void* pixels,
Options prevFrameOptions(options);
prevFrameOptions.fFrameIndex = requiredFrame;
prevFrameOptions.fZeroInitialized = kNo_ZeroInitialized;
- const Result result = this->getPixels(info, pixels, rowBytes, &prevFrameOptions,
- nullptr, nullptr);
+ const Result result = this->getPixels(info, pixels, rowBytes, &prevFrameOptions);
if (result == kSuccess) {
const auto* prevFrame = frameHolder->getFrame(requiredFrame);
const auto disposalMethod = prevFrame->getDisposalMethod();
@@ -266,7 +247,7 @@ SkCodec::Result SkCodec::handleFrameIndex(const SkImageInfo& info, void* pixels,
}
SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- const Options* options, SkPMColor ctable[], int* ctableCount) {
+ const Options* options) {
if (kUnknown_SkColorType == info.colorType()) {
return kInvalidConversion;
}
@@ -277,8 +258,6 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
return kInvalidParameters;
}
- CHECK_COLOR_TABLE;
-
if (!this->rewindIfNeeded()) {
return kCouldNotRewind;
}
@@ -314,14 +293,7 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
// On an incomplete decode, the subclass will specify the number of scanlines that it decoded
// successfully.
int rowsDecoded = 0;
- const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount,
- &rowsDecoded);
-
- if (ctableCount) {
- if (kIncompleteInput == result || kSuccess == result || kErrorInInput == result) {
- SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
- }
- }
+ const Result result = this->onGetPixels(info, pixels, rowBytes, *options, &rowsDecoded);
// A return value of kIncompleteInput indicates a truncated image stream.
// In this case, we will fill any uninitialized memory with a default value.
@@ -342,12 +314,8 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
return result;
}
-SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
- return this->getPixels(info, pixels, rowBytes, nullptr, nullptr, nullptr);
-}
-
SkCodec::Result SkCodec::startIncrementalDecode(const SkImageInfo& info, void* pixels,
- size_t rowBytes, const SkCodec::Options* options, SkPMColor* ctable, int* ctableCount) {
+ size_t rowBytes, const SkCodec::Options* options) {
fStartedIncrementalDecode = false;
if (kUnknown_SkColorType == info.colorType()) {
@@ -357,9 +325,6 @@ SkCodec::Result SkCodec::startIncrementalDecode(const SkImageInfo& info, void* p
return kInvalidParameters;
}
- // Ensure that valid color ptrs are passed in for kIndex8 color type
- CHECK_COLOR_TABLE;
-
// FIXME: If the rows come after the rows of a previous incremental decode,
// we might be able to skip the rewind, but only the implementation knows
// that. (e.g. PNG will always need to rewind, since we called longjmp, but
@@ -399,8 +364,7 @@ SkCodec::Result SkCodec::startIncrementalDecode(const SkImageInfo& info, void* p
fDstInfo = info;
fOptions = *options;
- const Result result = this->onStartIncrementalDecode(info, pixels, rowBytes,
- fOptions, ctable, ctableCount);
+ const Result result = this->onStartIncrementalDecode(info, pixels, rowBytes, fOptions);
if (kSuccess == result) {
fStartedIncrementalDecode = true;
} else if (kUnimplemented == result) {
@@ -418,11 +382,9 @@ SkCodec::Result SkCodec::startIncrementalDecode(const SkImageInfo& info, void* p
SkCodec::Result SkCodec::startScanlineDecode(const SkImageInfo& info,
- const SkCodec::Options* options, SkPMColor ctable[], int* ctableCount) {
+ const SkCodec::Options* options) {
// Reset fCurrScanline in case of failure.
fCurrScanline = -1;
- // Ensure that valid color ptrs are passed in for kIndex8 color type
- CHECK_COLOR_TABLE;
if (!this->rewindIfNeeded()) {
return kCouldNotRewind;
@@ -450,7 +412,7 @@ SkCodec::Result SkCodec::startScanlineDecode(const SkImageInfo& info,
return kInvalidScale;
}
- const Result result = this->onStartScanlineDecode(info, *options, ctable, ctableCount);
+ const Result result = this->onStartScanlineDecode(info, *options);
if (result != SkCodec::kSuccess) {
return result;
}
@@ -461,12 +423,6 @@ SkCodec::Result SkCodec::startScanlineDecode(const SkImageInfo& info,
return kSuccess;
}
-#undef CHECK_COLOR_TABLE
-
-SkCodec::Result SkCodec::startScanlineDecode(const SkImageInfo& info) {
- return this->startScanlineDecode(info, nullptr, nullptr, nullptr);
-}
-
int SkCodec::getScanlines(void* dst, int countLines, size_t rowBytes) {
if (fCurrScanline < 0) {
return 0;
@@ -530,7 +486,7 @@ uint64_t SkCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ? opaqueColor : transparentColor;
}
default: {
- // This not only handles the kN32 case, but also k565, kGray8, kIndex8, since
+ // This not only handles the kN32 case, but also k565, kGray8, since
// the low bits are zeros.
return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ?
SK_ColorBLACK : SK_ColorTRANSPARENT;
@@ -583,7 +539,6 @@ static inline SkColorSpaceXform::ColorFormat select_xform_format_ct(SkColorType
case kBGRA_8888_SkColorType:
return SkColorSpaceXform::kBGRA_8888_ColorFormat;
case kRGB_565_SkColorType:
- case kIndex_8_SkColorType:
#ifdef SK_PMCOLOR_IS_RGBA
return SkColorSpaceXform::kRGBA_8888_ColorFormat;
#else