Index: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
index 420a5a73e1add9e81eee9b441cf825282e69cf37..4cf6b14a44b1e89f2d3e238a7ded0d52c970386e 100644 |
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
@@ -86,10 +86,7 @@ class PLATFORM_EXPORT ImageDecoder { |
enum AlphaOption { AlphaPremultiplied, AlphaNotPremultiplied }; |
- enum GammaAndColorProfileOption { |
- GammaAndColorProfileApplied, |
- GammaAndColorProfileIgnored |
- }; |
+ enum ColorSpaceOption { ColorSpaceApplied, ColorSpaceIgnored }; |
virtual ~ImageDecoder() {} |
@@ -100,12 +97,11 @@ class PLATFORM_EXPORT ImageDecoder { |
static std::unique_ptr<ImageDecoder> create(PassRefPtr<SegmentReader> data, |
bool dataComplete, |
AlphaOption, |
- GammaAndColorProfileOption); |
- static std::unique_ptr<ImageDecoder> create( |
- PassRefPtr<SharedBuffer> data, |
- bool dataComplete, |
- AlphaOption alphaoption, |
- GammaAndColorProfileOption colorOptions) { |
+ ColorSpaceOption); |
+ static std::unique_ptr<ImageDecoder> create(PassRefPtr<SharedBuffer> data, |
+ bool dataComplete, |
+ AlphaOption alphaoption, |
+ ColorSpaceOption colorOptions) { |
return create(SegmentReader::createFromSharedBuffer(std::move(data)), |
dataComplete, alphaoption, colorOptions); |
} |
@@ -210,18 +206,16 @@ class PLATFORM_EXPORT ImageDecoder { |
ImageOrientation orientation() const { return m_orientation; } |
- bool ignoresGammaAndColorProfile() const { |
- return m_ignoreGammaAndColorProfile; |
- } |
+ bool ignoresColorSpace() const { return m_ignoreColorSpace; } |
static void setTargetColorProfile(const WebVector<char>&); |
- // Note that hasColorProfile refers to the existence of a not-ignored |
- // embedded color profile, and is independent of whether or not that |
- // profile's transform has been baked into the pixel values. |
- bool hasColorProfile() const { return m_hasColorProfile; } |
+ // Note that hasColorSpace refers to the existence of a not-ignored |
+ // embedded color space, and is independent of whether or not that |
+ // space's transform has been baked into the pixel values. |
+ bool hasColorSpace() const { return m_srcSpace.get(); } |
void setColorSpaceAndComputeTransform(const char* iccData, |
- unsigned iccLength, |
- bool useSRGB); |
+ unsigned iccLength); |
+ void setColorSpaceAndComputeTransform(sk_sp<SkColorSpace> srcSpace); |
// Transformation from encoded color space to target color space. |
SkColorSpaceXform* colorTransform() { |
@@ -265,11 +259,10 @@ class PLATFORM_EXPORT ImageDecoder { |
protected: |
ImageDecoder(AlphaOption alphaOption, |
- GammaAndColorProfileOption colorOptions, |
+ ColorSpaceOption colorOptions, |
size_t maxDecodedBytes) |
: m_premultiplyAlpha(alphaOption == AlphaPremultiplied), |
- m_ignoreGammaAndColorProfile(colorOptions == |
- GammaAndColorProfileIgnored), |
+ m_ignoreColorSpace(colorOptions == ColorSpaceIgnored), |
m_maxDecodedBytes(maxDecodedBytes), |
m_purgeAggressively(false) {} |
@@ -308,13 +301,13 @@ class PLATFORM_EXPORT ImageDecoder { |
// Decodes the requested frame. |
virtual void decode(size_t) = 0; |
- // Returns the embedded image color profile. |
- const ImageFrame::ICCProfile& colorProfile() const { return m_colorProfile; } |
+ // Returns the embedded image color space. |
+ sk_sp<SkColorSpace> colorSpace() const { return m_srcSpace; } |
RefPtr<SegmentReader> m_data; // The encoded data. |
Vector<ImageFrame, 1> m_frameBufferCache; |
const bool m_premultiplyAlpha; |
- const bool m_ignoreGammaAndColorProfile; |
+ const bool m_ignoreColorSpace; |
ImageOrientation m_orientation; |
// The maximum amount of memory a decoded image should require. Ideally, |
@@ -349,9 +342,7 @@ class PLATFORM_EXPORT ImageDecoder { |
bool m_isAllDataReceived = false; |
bool m_failed = false; |
- bool m_hasColorProfile = false; |
- ImageFrame::ICCProfile m_colorProfile; |
- |
+ sk_sp<SkColorSpace> m_srcSpace = nullptr; |
std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform; |
}; |