diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-08-18 10:53:24 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-18 19:46:59 +0000 |
commit | ae79f32e79e39d399d9e3ecdaf9e0fc360928989 (patch) | |
tree | 6e697fc9323b9336ec05417f8aa922122d3ffece /src/codec/SkPngCodec.cpp | |
parent | 141df44fd82b5d9223025a5daa463fcf22d8416f (diff) |
Call initializeColorXform inside SkCodec
Make initializeColorXform private, and only call in the base class.
Add virtual method to skip initializeColorXform, for classes that do
not need one.
Change SkCodec::FrameInfo's SkAlphaType to an SkEncodedInfo::Alpha.
This allows proper checking internally whether SkCodec needs to do a
color correct premultiply.
Depends on https://chromium-review.googlesource.com/c/620947, for this
API change.
(Separated from review.skia.org/25746)
Bug: skia:5609
Bug: skia:6839
Change-Id: Icb0d46659c546060c34d32eaf792c86708726c7a
Reviewed-on: https://skia-review.googlesource.com/35880
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkPngCodec.cpp')
-rw-r--r-- | src/codec/SkPngCodec.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp index c5dae3ed4a..08f23dddea 100644 --- a/src/codec/SkPngCodec.cpp +++ b/src/codec/SkPngCodec.cpp @@ -263,7 +263,8 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo) { 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->getEncodedInfo()); + bool premultiply = !this->colorXform() && needs_premul(dstInfo.alphaType(), + this->getEncodedInfo().alpha()); // 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. @@ -980,10 +981,6 @@ SkCodec::Result SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const O // interlaced scanline decoder may need to rewind. fSwizzler.reset(nullptr); - if (!this->initializeColorXform(dstInfo, options.fPremulBehavior)) { - return kInvalidConversion; - } - // If SkColorSpaceXform directly supports the encoded PNG format, we should skip format // conversion in the swizzler (or skip swizzling altogether). bool skipFormatConversion = false; |