aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngCodec.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/SkPngCodec.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/SkPngCodec.cpp')
-rw-r--r--src/codec/SkPngCodec.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index da6e062dac..a7359ee848 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -231,7 +231,7 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
if (png_get_tRNS(fPng_ptr, fInfo_ptr, &alphas, &numColorsWithAlpha, nullptr)) {
// If we are performing a color xform, it will handle the premultiply. Otherwise,
// we'll do it here.
- bool premultiply = !this->colorXform() && needs_premul(dstInfo, this->getInfo());
+ bool premultiply = !this->colorXform() && needs_premul(dstInfo, this->getInfo());
// Choose which function to use to create the color table. If the final destination's
// colortype is unpremultiplied, the color table will store unpremultiplied colors.
@@ -267,9 +267,7 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
// If we are not decoding to F16, we can color xform now and store the results
// in the color table.
if (this->colorXform() && kRGBA_F16_SkColorType != dstInfo.colorType()) {
- SkColorSpaceXform::ColorFormat xformColorFormat = is_rgba(dstInfo.colorType()) ?
- SkColorSpaceXform::kRGBA_8888_ColorFormat :
- SkColorSpaceXform::kBGRA_8888_ColorFormat;
+ SkColorSpaceXform::ColorFormat xformColorFormat = select_xform_format(dstInfo.colorType());
SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
SkAssertResult(this->colorXform()->apply(xformColorFormat, colorTable,
@@ -1111,11 +1109,6 @@ void SkPngCodec::initializeXformParams() {
}
}
-static inline bool apply_xform_on_decode(SkColorType dstColorType, SkEncodedInfo::Color srcColor) {
- // We will apply the color xform when reading the color table, unless F16 is requested.
- return SkEncodedInfo::kPalette_Color != srcColor || kRGBA_F16_SkColorType == dstColorType;
-}
-
void SkPngCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
SkImageInfo swizzlerInfo = dstInfo;
Options swizzlerOptions = options;