aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpRLECodec.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-11-04 11:52:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-04 16:25:27 +0000
commit1a85ca5c908b421ea8f07798d56c4481bbc5d5af (patch)
tree950dc8aa3dbba05f4ad987d5a76d8461b2fc5ac5 /src/codec/SkBmpRLECodec.cpp
parent4d53c44aa6e8e0d1b6537f83e4287e5a1423ac75 (diff)
Fix color xforms for Index8 bmps
Thanks to Gold for catching this. BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4426 Change-Id: Icc816d933e9e2fd312858a5430fa21a47722563e Reviewed-on: https://skia-review.googlesource.com/4426 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkBmpRLECodec.cpp')
-rw-r--r--src/codec/SkBmpRLECodec.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index 85b965e611..b8013093fb 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -276,9 +276,16 @@ SkCodec::Result SkBmpRLECodec::onPrepareToDecode(const SkImageInfo& dstInfo,
fSampleX = 1;
fLinesToSkip = 0;
+ SkColorType colorTableColorType = dstInfo.colorType();
+ if (this->colorXform()) {
+ // Just set a known colorType for the colorTable. No need to actually transform
+ // the colors in the colorTable since we do not allow decoding RLE to kIndex8.
+ colorTableColorType = kBGRA_8888_SkColorType;
+ }
+
// Create the color table if necessary and prepare the stream for decode
// Note that if it is non-NULL, inputColorCount will be modified
- if (!this->createColorTable(dstInfo.colorType(), inputColorCount)) {
+ if (!this->createColorTable(colorTableColorType, inputColorCount)) {
SkCodecPrintf("Error: could not create color table.\n");
return SkCodec::kInvalidInput;
}