From b62f50cf763279fa0d0aa2f80624de02c7a1c2fb Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Thu, 12 Jul 2018 14:44:27 -0400 Subject: Replace nearly all kRespect with kIgnore - Encoders and decoders always assume kIgnore. - They are less opinionated about F16 and color space, we just trust the color space that's passed in, and put that directly in the image (no sRGB encoding). - SkBitmap and SkPixmap read/write pixels functions were defaulting to kResepct, those are now always kIgnore. - Many other bits of plumbing are simplified, and I added a default of kIgnore to SkImage::makeColorSpace, so we can phase out that argument entirely. - Still need to add defaults to other public APIs that take SkTransferFunctionBehavior. - This makes gold think that we've dramatically changed the contents of all F16 images, but that's because it doesn't understand the (now linear) color space that's embedded. Once we triage them all once, they will work fine (and they'll look perfect in the browser). Bug: skia: Change-Id: I62fa090f96cae1b67d181ce14bd91f34ff2ed747 Reviewed-on: https://skia-review.googlesource.com/140570 Commit-Queue: Brian Osman Reviewed-by: Mike Klein --- include/codec/SkCodec.h | 5 ++--- include/core/SkBitmap.h | 4 ++-- include/core/SkImage.h | 5 +++-- include/core/SkPixmap.h | 2 +- include/encode/SkJpegEncoder.h | 2 +- include/encode/SkPngEncoder.h | 2 +- include/encode/SkWebpEncoder.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index ae7286d576..c156efb052 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -252,7 +252,7 @@ public: , fSubset(nullptr) , fFrameIndex(0) , fPriorFrame(kNone) - , fPremulBehavior(SkTransferFunctionBehavior::kRespect) + , fPremulBehavior(SkTransferFunctionBehavior::kIgnore) {} ZeroInitialized fZeroInitialized; @@ -803,8 +803,7 @@ protected: virtual int onOutputScanline(int inputScanline) const; - bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha, - SkTransferFunctionBehavior premulBehavior); + bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha); // Some classes never need a colorXform e.g. // - ICO uses its embedded codec's colorXform // - WBMP is just Black/White diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 758881aae3..bc29151a24 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -992,7 +992,7 @@ public: bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) const { return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, - SkTransferFunctionBehavior::kRespect); + SkTransferFunctionBehavior::kIgnore); } /** Copies a SkRect of pixels from SkBitmap to dst. Copy starts at (srcX, srcY), and @@ -1074,7 +1074,7 @@ public: @return true if src pixels are copied to SkBitmap */ bool writePixels(const SkPixmap& src, int dstX, int dstY) { - return this->writePixels(src, dstX, dstY, SkTransferFunctionBehavior::kRespect); + return this->writePixels(src, dstX, dstY, SkTransferFunctionBehavior::kIgnore); } /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 8957d11b61..f04dd45c78 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -877,8 +877,9 @@ public: SkTransferFunctionBehavior::kIgnore @return created SkImage in target SkColorSpace */ - sk_sp makeColorSpace(sk_sp target, - SkTransferFunctionBehavior premulBehavior) const; + sk_sp makeColorSpace( + sk_sp target, + SkTransferFunctionBehavior premulBehavior = SkTransferFunctionBehavior::kIgnore) const; private: SkImage(int width, int height, uint32_t uniqueID); diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h index 5e417af2ed..d3e0097e70 100644 --- a/include/core/SkPixmap.h +++ b/include/core/SkPixmap.h @@ -616,7 +616,7 @@ public: bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) const { return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, - SkTransferFunctionBehavior::kRespect); + SkTransferFunctionBehavior::kIgnore); } /** Copies a SkRect of pixels to dst. Copy starts at (srcX, srcY), and does not diff --git a/include/encode/SkJpegEncoder.h b/include/encode/SkJpegEncoder.h index fd7c204161..ad3ccad21a 100644 --- a/include/encode/SkJpegEncoder.h +++ b/include/encode/SkJpegEncoder.h @@ -61,7 +61,7 @@ public: * In the second case, the encoder supports linear or legacy blending. */ AlphaOption fAlphaOption = AlphaOption::kIgnore; - SkTransferFunctionBehavior fBlendBehavior = SkTransferFunctionBehavior::kRespect; + SkTransferFunctionBehavior fBlendBehavior = SkTransferFunctionBehavior::kIgnore; }; /** diff --git a/include/encode/SkPngEncoder.h b/include/encode/SkPngEncoder.h index 39e407e075..035da42fe7 100644 --- a/include/encode/SkPngEncoder.h +++ b/include/encode/SkPngEncoder.h @@ -58,7 +58,7 @@ public: * The encoder can convert to linear before unpremultiplying or ignore the transfer * function and unpremultiply the input as is. */ - SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kRespect; + SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kIgnore; /** * Represents comments in the tEXt ancillary chunk of the png. diff --git a/include/encode/SkWebpEncoder.h b/include/encode/SkWebpEncoder.h index f671be379c..f7dca61278 100644 --- a/include/encode/SkWebpEncoder.h +++ b/include/encode/SkWebpEncoder.h @@ -40,7 +40,7 @@ namespace SkWebpEncoder { * The encoder can convert to linear before unpremultiplying or ignore the transfer * function and unpremultiply the input as is. */ - SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kRespect; + SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kIgnore; }; /** -- cgit v1.2.3