aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngCodec.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-04-03 16:01:10 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-04 15:22:04 +0000
commit19aff5dd5cd83141f12c234c4255a35f63e564cd (patch)
treecde4a5f4723319325bff3491368e408232b26e0b /src/codec/SkPngCodec.cpp
parent114e6b33d67537f034b749e77f68d168ef9bfbc6 (diff)
565 codec color xform support: fix colortable / incomplete image behavior
This fixes a bug that was exposed when I added color space support for 565 decodes. Before this CL, we would sometimes fill incomplete images with R and B swapped. This fixes that issue. Part of the fix is the decision to do 565 xforms when building the color table (then just swizzle to 565), rather than do them per pixel after swizzling. Bug: skia: Change-Id: I09e1ec75aba09a4e288015ea746465d0c3f7d59f Reviewed-on: https://skia-review.googlesource.com/11137 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/codec/SkPngCodec.cpp')
-rw-r--r--src/codec/SkPngCodec.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index f1601de189..8bab368cdf 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -269,7 +269,8 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
if (this->colorXform() &&
!apply_xform_on_decode(dstInfo.colorType(), this->getEncodedInfo().color())) {
- const SkColorSpaceXform::ColorFormat dstFormat = select_xform_format(dstInfo.colorType());
+ const SkColorSpaceXform::ColorFormat dstFormat =
+ select_xform_format_ct(dstInfo.colorType());
const SkColorSpaceXform::ColorFormat srcFormat = select_xform_format(kXformSrcColorType);
const SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
@@ -1277,7 +1278,7 @@ uint64_t SkPngCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
SkAlphaType alphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
return get_color_table_fill_value(dstInfo.colorType(), alphaType, colorPtr, 0,
- this->colorXform());
+ this->colorXform(), true);
}
return INHERITED::onGetFillValue(dstInfo);
}