aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkGifCodec.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/SkGifCodec.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/SkGifCodec.cpp')
-rw-r--r--src/codec/SkGifCodec.cpp44
1 files changed, 5 insertions, 39 deletions
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 89889d2555..081f237fe1 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -94,10 +94,6 @@ SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
// expanding to 8 bits and take advantage of the SkSwizzler to work from 4.
const auto encodedInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color, alpha, 8);
- // Although the encodedInfo is always kPalette_Color, it is possible that kIndex_8 is
- // unsupported if the frame is subset and there is no transparent pixel.
- const auto colorType = reader->firstFrameSupportsIndex8() ? kIndex_8_SkColorType
- : kN32_SkColorType;
// The choice of unpremul versus premul is arbitrary, since all colors are either fully
// opaque or fully transparent (i.e. kBinary), but we stored the transparent colors as all
// zeroes, which is arguably premultiplied.
@@ -105,7 +101,7 @@ SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
: kOpaque_SkAlphaType;
const auto imageInfo = SkImageInfo::Make(reader->screenWidth(), reader->screenHeight(),
- colorType, alphaType,
+ kN32_SkColorType, alphaType,
SkColorSpace::MakeSRGB());
return new SkGifCodec(encodedInfo, imageInfo, reader.release());
}
@@ -189,8 +185,7 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, int frameIndex
}
-SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColor* inputColorPtr,
- int* inputColorCount, const Options& opts) {
+SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, const Options& opts) {
if (opts.fSubset) {
return gif_error("Subsets not supported.\n", kUnimplemented);
}
@@ -251,11 +246,6 @@ SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
this->initializeSwizzler(dstInfo, frameIndex);
SkASSERT(fCurrColorTable);
- if (inputColorCount) {
- *inputColorCount = fCurrColorTable->count();
- }
- copy_color_table(dstInfo, fCurrColorTable.get(), inputColorPtr, inputColorCount);
-
return kSuccess;
}
@@ -297,10 +287,8 @@ void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, int frameIndex)
SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
void* pixels, size_t dstRowBytes,
const Options& opts,
- SkPMColor* inputColorPtr,
- int* inputColorCount,
int* rowsDecoded) {
- Result result = this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, opts);
+ Result result = this->prepareToDecode(dstInfo, opts);
switch (result) {
case kSuccess:
break;
@@ -328,10 +316,8 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
SkCodec::Result SkGifCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo,
void* pixels, size_t dstRowBytes,
- const SkCodec::Options& opts,
- SkPMColor* inputColorPtr,
- int* inputColorCount) {
- Result result = this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, opts);
+ const SkCodec::Options& opts) {
+ Result result = this->prepareToDecode(dstInfo, opts);
if (result != kSuccess) {
return result;
}
@@ -423,28 +409,8 @@ SkCodec::Result SkGifCodec::decodeFrame(bool firstAttempt, const Options& opts,
}
uint64_t SkGifCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
- // Note: Using fCurrColorTable relies on having called initializeColorTable already.
- // This is (currently) safe because this method is only called when filling, after
- // initializeColorTable has been called.
- // FIXME: Is there a way to make this less fragile?
- if (dstInfo.colorType() == kIndex_8_SkColorType && fCurrColorTableIsReal) {
- // We only support index 8 for the first frame, for backwards
- // compatibity on Android, so we are using the color table for the first frame.
- SkASSERT(this->options().fFrameIndex == 0);
- // Use the transparent index for the first frame.
- const int transPixel = fReader->frameContext(0)->transparentPixel();
- if (transPixel >= 0 && transPixel < fCurrColorTable->count()) {
- return transPixel;
- }
- // Fall through to return SK_ColorTRANSPARENT (i.e. 0). This choice is arbitrary,
- // but we have to pick something inside the color table, and this one is as good
- // as any.
- }
// Using transparent as the fill value matches the behavior in Chromium,
// which ignores the background color.
- // If the colorType is kIndex_8, and there was no color table (i.e.
- // fCurrColorTableIsReal is false), this value (zero) corresponds to the
- // only entry in the dummy color table provided to the client.
return SK_ColorTRANSPARENT;
}