Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 2462803002: Plumb color space to DecodingImageGenerator and ImageFrameGenerator (Closed)
Patch Set: Incorporate review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4cf6b14a44b1e89f2d3e238a7ded0d52c970386e..d6169b58aeebc72104ed8a14f883ad644a14f644 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -209,12 +209,19 @@ class PLATFORM_EXPORT ImageDecoder {
bool ignoresColorSpace() const { return m_ignoreColorSpace; }
static void setTargetColorProfile(const WebVector<char>&);
- // 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);
+ // This returns the color space of this image. If the image had no embedded
+ // color profile, this will return sRGB. Returns nullptr if color correct
+ // rendering is not enabled.
+ sk_sp<SkColorSpace> colorSpace() const;
+
+ // This returns whether or not the image included a not-ignored embedded
+ // color space. This is independent of whether or not that space's transform
+ // has been baked into the pixel values.
+ bool hasEmbeddedColorSpace() const { return m_embeddedColorSpace.get(); }
+
+ // Set the embedded color space directly or via ICC profile.
+ void setColorProfileAndComputeTransform(const char* iccData,
+ unsigned iccLength);
void setColorSpaceAndComputeTransform(sk_sp<SkColorSpace> srcSpace);
// Transformation from encoded color space to target color space.
@@ -301,9 +308,6 @@ class PLATFORM_EXPORT ImageDecoder {
// Decodes the requested frame.
virtual void decode(size_t) = 0;
- // 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;
@@ -342,7 +346,7 @@ class PLATFORM_EXPORT ImageDecoder {
bool m_isAllDataReceived = false;
bool m_failed = false;
- sk_sp<SkColorSpace> m_srcSpace = nullptr;
+ sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr;
std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform;
};

Powered by Google App Engine
This is Rietveld 408576698