From ae79f32e79e39d399d9e3ecdaf9e0fc360928989 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Fri, 18 Aug 2017 10:53:24 -0400 Subject: 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 Reviewed-by: Derek Sollenberger Reviewed-by: Mike Klein Commit-Queue: Leon Scroggins --- include/codec/SkCodec.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/codec') diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index 30bbd0f71c..5e80f8fc2c 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -619,7 +619,10 @@ public: * This is conservative; it will still return non-opaque if e.g. a * color index-based frame has a color with alpha but does not use it. */ +#ifdef SK_LEGACY_FRAME_INFO_ALPHA_TYPE SkAlphaType fAlphaType; +#endif + SkEncodedInfo::Alpha fAlpha; /** * How this frame should be modified before decoding the next one. @@ -806,8 +809,12 @@ protected: virtual int onOutputScanline(int inputScanline) const; - bool initializeColorXform(const SkImageInfo& dstInfo, + bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha, SkTransferFunctionBehavior premulBehavior); + // Some classes never need a colorXform e.g. + // - ICO uses its embedded codec's colorXform + // - WBMP is just Black/White + virtual bool usesColorXform() const { return true; } void applyColorXform(void* dst, const void* src, int count, SkAlphaType) const; void applyColorXform(void* dst, const void* src, int count) const; -- cgit v1.2.3