diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/codec/SkCodec.h | 9 | ||||
-rw-r--r-- | include/core/SkBitmap.h | 79 | ||||
-rw-r--r-- | include/core/SkColorSpace.h | 13 | ||||
-rw-r--r-- | include/core/SkImage.h | 17 | ||||
-rw-r--r-- | include/core/SkPixmap.h | 41 | ||||
-rw-r--r-- | include/encode/SkJpegEncoder.h | 1 | ||||
-rw-r--r-- | include/encode/SkPngEncoder.h | 7 | ||||
-rw-r--r-- | include/encode/SkWebpEncoder.h | 7 |
8 files changed, 4 insertions, 170 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index c156efb052..36f557e603 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -252,7 +252,6 @@ public: , fSubset(nullptr) , fFrameIndex(0) , fPriorFrame(kNone) - , fPremulBehavior(SkTransferFunctionBehavior::kIgnore) {} ZeroInitialized fZeroInitialized; @@ -296,14 +295,6 @@ public: * If set to kNone, the codec will decode any necessary required frame(s) first. */ int fPriorFrame; - - /** - * Indicates whether we should do a linear premultiply or a legacy premultiply. - * - * In the case where the dst SkColorSpace is nullptr, this flag is ignored and - * we will always do a legacy premultiply. - */ - SkTransferFunctionBehavior fPremulBehavior; }; /** diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 521bb77ac8..5a980e0e07 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -923,44 +923,6 @@ public: */ bool extractSubset(SkBitmap* dst, const SkIRect& subset) const; - /** Copies SkRect of pixels from SkBitmap pixels to dstPixels. Copy starts at (srcX, srcY), - and does not exceed SkBitmap (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and - SkColorSpace of destination. dstRowBytes specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if: - - dstInfo.addr() equals nullptr - - dstRowBytes is less than dstInfo.minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkBitmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkBitmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(srcX) >= Bitmap width(), or if abs(srcY) >= Bitmap height(). - - If behavior is SkTransferFunctionBehavior::kRespect: converts source - pixels to a linear space before converting to dstInfo. - If behavior is SkTransferFunctionBehavior::kIgnore: source - pixels are treated as if they are linear, regardless of how they are encoded. - - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @param behavior one of: SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore - @return true if pixels are copied to dstPixels - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY, SkTransferFunctionBehavior behavior) const; - /** Copies a SkRect of pixels from SkBitmap to dstPixels. Copy starts at (srcX, srcY), and does not exceed SkBitmap (width(), height()). @@ -990,10 +952,7 @@ public: @return true if pixels are copied to dstPixels */ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY) const { - return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, - SkTransferFunctionBehavior::kIgnore); - } + int srcX, int srcY) const; /** Copies a SkRect of pixels from SkBitmap to dst. Copy starts at (srcX, srcY), and does not exceed SkBitmap (width(), height()). @@ -1073,9 +1032,7 @@ public: @param dstY row index whose absolute value is less than height() @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::kIgnore); - } + bool writePixels(const SkPixmap& src, int dstX, int dstY); /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed (src.width(), src.height()). @@ -1101,38 +1058,6 @@ public: return this->writePixels(src, 0, 0); } - /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed - (src.width(), src.height()). - - src specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of source. src.rowBytes() specifics the gap from one source - row to the next. Returns true if pixels are copied. Returns false if: - - src pixel storage equals nullptr - - src.rowBytes is less than SkImageInfo::minRowBytes - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; src SkColorType must match. - If SkBitmap colorType() is kGray_8_SkColorType, src SkColorSpace must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, src SkAlphaType must - match. If SkBitmap colorSpace() is nullptr, src SkColorSpace must match. Returns - false if pixel conversion is not possible. Returns false if width() or height() - is zero or negative. - - If behavior is SkTransferFunctionBehavior::kRespect: converts src - pixels to a linear space before converting to SkImageInfo. - If behavior is SkTransferFunctionBehavior::kIgnore: src - pixels are treated as if they are linear, regardless of how they are encoded. - - @param src source SkPixmap: SkImageInfo, pixels, row bytes - @param x column index whose absolute value is less than width() - @param y row index whose absolute value is less than height() - @param behavior one of: SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore - @return true if src pixels are copied to SkBitmap - */ - bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior); - #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK /** For use by Android framework only. diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h index 4265fcb352..eaafc25441 100644 --- a/include/core/SkColorSpace.h +++ b/include/core/SkColorSpace.h @@ -272,17 +272,4 @@ private: using INHERITED = SkRefCnt; }; -enum class SkTransferFunctionBehavior { - /** - * Converts to a linear space before premultiplying, unpremultiplying, or blending. - */ - kRespect, - - /** - * Premultiplies, unpremultiplies, and blends ignoring the transfer function. Pixels are - * treated as if they are linear, regardless of their transfer function encoding. - */ - kIgnore, -}; - #endif diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 7e477ec8d3..1db8a9876a 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -862,25 +862,10 @@ public: Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace. If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB. - SkTransferFunctionBehavior is to be deprecated. - - Set premulBehavior to SkTransferFunctionBehavior::kRespect to convert SkImage - pixels to a linear space, before converting to destination SkColorType - and SkColorSpace. - - Set premulBehavior to SkTransferFunctionBehavior::kIgnore to treat SkImage - pixels as linear, when converting to destination SkColorType - and SkColorSpace, ignoring pixel encoding. premulBehavior is - SkTransferFunctionBehavior::kIgnore by default. - @param target SkColorSpace describing color range of returned SkImage - @param premulBehavior one of: SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore @return created SkImage in target SkColorSpace */ - sk_sp<SkImage> makeColorSpace( - sk_sp<SkColorSpace> target, - SkTransferFunctionBehavior premulBehavior = SkTransferFunctionBehavior::kIgnore) const; + sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target) const; private: SkImage(int width, int height, uint32_t uniqueID); diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h index d3e0097e70..c98b5cf866 100644 --- a/include/core/SkPixmap.h +++ b/include/core/SkPixmap.h @@ -525,42 +525,6 @@ public: return reinterpret_cast<uint16_t*>(writable_addr64(x, y)); } - /** Copies a SkRect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not - exceed SkPixmap (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and - SkColorSpace of destination. dstRowBytes specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if - dstInfo.addr() equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes(). - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkPixmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkPixmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. Returns false if: - abs(srcX) >= Pixmap width(), or if abs(srcY) >= Pixmap height(). - - If behavior is SkTransferFunctionBehavior::kRespect: converts source - pixels to a linear space before converting to dstInfo. - If behavior is SkTransferFunctionBehavior::kIgnore: source - pixels are treated as if they are linear, regardless of how they are encoded. - - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @param behavior one of: SkTransferFunctionBehavior::kRespect, - SkTransferFunctionBehavior::kIgnore - @return true if pixels are copied to dstPixels - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY, SkTransferFunctionBehavior behavior) const; - /** Copies a SkRect of pixels to dstPixels. Copy starts at (0, 0), and does not exceed SkPixmap (width(), height()). @@ -614,10 +578,7 @@ public: @return true if pixels are copied to dstPixels */ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, - int srcY) const { - return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, - SkTransferFunctionBehavior::kIgnore); - } + int srcY) const; /** Copies a SkRect of pixels to dst. Copy starts at (srcX, srcY), and does not exceed SkPixmap (width(), height()). dst specifies width, height, SkColorType, diff --git a/include/encode/SkJpegEncoder.h b/include/encode/SkJpegEncoder.h index ad3ccad21a..5e657a5b6a 100644 --- a/include/encode/SkJpegEncoder.h +++ b/include/encode/SkJpegEncoder.h @@ -61,7 +61,6 @@ public: * In the second case, the encoder supports linear or legacy blending. */ AlphaOption fAlphaOption = AlphaOption::kIgnore; - SkTransferFunctionBehavior fBlendBehavior = SkTransferFunctionBehavior::kIgnore; }; /** diff --git a/include/encode/SkPngEncoder.h b/include/encode/SkPngEncoder.h index 035da42fe7..2e1f7d731a 100644 --- a/include/encode/SkPngEncoder.h +++ b/include/encode/SkPngEncoder.h @@ -54,13 +54,6 @@ public: int fZLibLevel = 6; /** - * If the input is premultiplied, this controls the unpremultiplication behavior. - * The encoder can convert to linear before unpremultiplying or ignore the transfer - * function and unpremultiply the input as is. - */ - SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kIgnore; - - /** * Represents comments in the tEXt ancillary chunk of the png. * The 2i-th entry is the keyword for the i-th comment, * and the (2i + 1)-th entry is the text for the i-th comment. diff --git a/include/encode/SkWebpEncoder.h b/include/encode/SkWebpEncoder.h index f7dca61278..8d5f4a6c75 100644 --- a/include/encode/SkWebpEncoder.h +++ b/include/encode/SkWebpEncoder.h @@ -34,13 +34,6 @@ namespace SkWebpEncoder { */ Compression fCompression = Compression::kLossy; float fQuality = 100.0f; - - /** - * If the input is premultiplied, this controls the unpremultiplication behavior. - * The encoder can convert to linear before unpremultiplying or ignore the transfer - * function and unpremultiply the input as is. - */ - SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kIgnore; }; /** |