diff options
author | Leon Scroggins <scroggo@google.com> | 2017-07-11 17:35:31 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-11 18:00:31 +0000 |
commit | 571b30f6117eede6d64cd2b924dc1f6aaa59e70e (patch) | |
tree | a617b52ab7728fc7b2324fef75a0775438d94d71 /tests/GifTest.cpp | |
parent | f778eb2f51572d57a75e1a9cec25d5495f6662e1 (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 'tests/GifTest.cpp')
-rw-r--r-- | tests/GifTest.cpp | 54 |
1 files changed, 1 insertions, 53 deletions
diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp index 0168d89d83..7728d27dcb 100644 --- a/tests/GifTest.cpp +++ b/tests/GifTest.cpp @@ -238,25 +238,11 @@ DEF_TEST(Gif_Sampled, r) { return; } - // Construct a color table for the decode if necessary - sk_sp<SkColorTable> colorTable(nullptr); - SkPMColor* colorPtr = nullptr; - int* colorCountPtr = nullptr; - int maxColors = 256; - if (kIndex_8_SkColorType == codec->getInfo().colorType()) { - SkPMColor colors[256]; - colorTable.reset(new SkColorTable(colors, maxColors)); - colorPtr = const_cast<SkPMColor*>(colorTable->readColors()); - colorCountPtr = &maxColors; - } - SkAndroidCodec::AndroidOptions options; options.fSampleSize = 4; - options.fColorPtr = colorPtr; - options.fColorCount = colorCountPtr; SkBitmap bm; - bm.allocPixels(codec->getInfo(), colorTable); + bm.allocPixels(codec->getInfo()); const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm.getPixels(), bm.rowBytes(), &options); REPORTER_ASSERT(r, result == SkCodec::kSuccess); @@ -273,41 +259,3 @@ DEF_TEST(Codec_GifTruncated, r) { std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(data)); REPORTER_ASSERT(r, !codec); } - -// There was a bug where SkAndroidCodec::computeOutputColorType returned kIndex_8 for -// GIFs that did not support kIndex_8. Verify that for such an image, the method computes -// something that it can actually decode to. -DEF_TEST(Codec_GifIndex8, r) { - std::unique_ptr<SkStream> stream(GetResourceAsStream("randPixelsOffset.gif")); - if (!stream) { - return; - } - - std::unique_ptr<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.release())); - REPORTER_ASSERT(r, codec); - if (!codec) { - return; - } - - REPORTER_ASSERT(r, codec->getInfo().colorType() == kN32_SkColorType); - const SkColorType outputColorType = codec->computeOutputColorType(kN32_SkColorType); - REPORTER_ASSERT(r, outputColorType == kN32_SkColorType); - - SkAndroidCodec::AndroidOptions options; - sk_sp<SkColorTable> colorTable(nullptr); - int maxColors = 256; - if (kIndex_8_SkColorType == outputColorType) { - SkPMColor colors[256]; - colorTable.reset(new SkColorTable(colors, maxColors)); - options.fColorPtr = const_cast<SkPMColor*>(colorTable->readColors()); - options.fColorCount = &maxColors; - } - - auto info = codec->getInfo().makeColorType(outputColorType); - SkBitmap bm; - bm.setInfo(info); - bm.allocPixels(colorTable.get()); - - REPORTER_ASSERT(r, SkCodec::kSuccess == codec->getAndroidPixels(info, bm.getPixels(), - bm.rowBytes(), &options)); -} |