diff options
author | Leon Scroggins III <scroggo@google.com> | 2016-12-22 09:53:21 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-22 15:30:50 +0000 |
commit | 9be9a42c928a1093a3130f79e71ef55a4e770a9e (patch) | |
tree | 3503618c11004d6a0d11afc32087ecb69587ed4f /src/codec/SkCodecImageGenerator.cpp | |
parent | d5733c70df5baada798eb166db7cac2cefa0479a (diff) |
Do not support index8 for generateScaledPixels
Since the in/out parameter is a const SkPixmap without the proper
color table, there is no way to tell the client about it without
modifying the const SkPixmap. Rather than cheating, just return
false.
Change-Id: I63fdf57febc59e1ee9af13aa6eb9b253d19bcb17
Reviewed-on: https://skia-review.googlesource.com/6414
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkCodecImageGenerator.cpp')
-rw-r--r-- | src/codec/SkCodecImageGenerator.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp index fcbd7c3cac..0758878146 100644 --- a/src/codec/SkCodecImageGenerator.cpp +++ b/src/codec/SkCodecImageGenerator.cpp @@ -61,26 +61,13 @@ bool SkCodecImageGenerator::onComputeScaledDimensions(SkScalar scale, SupportedS } bool SkCodecImageGenerator::onGenerateScaledPixels(const SkPixmap& pixmap) { - SkPMColor colorStorage[256]; - int colorCount = 256; - const auto result = fCodec->getPixels(pixmap.info(), pixmap.writable_addr(), - pixmap.rowBytes(), nullptr, colorStorage, &colorCount); - switch (result) { - case SkCodec::kSuccess: - case SkCodec::kIncompleteInput: - break; - default: - return false; - } - if (pixmap.colorType() == kIndex_8_SkColorType) { - // SkPixmap does not take ownership, so we need to hang onto this. - // FIXME: With a better API on SkCodec, the SkCodec could share its SkColorTable. - fColorTable.reset(new SkColorTable(colorStorage, colorCount)); - const_cast<SkPixmap&>(pixmap).reset(pixmap.info(), pixmap.addr(), pixmap.rowBytes(), - fColorTable.get()); + // There is no way to tell the client about the color table with this API. + return false; } - return true; + + return this->onGetPixels(pixmap.info(), pixmap.writable_addr(), pixmap.rowBytes(), + nullptr, nullptr); } |