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

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

Issue 2203903002: Color: Read embedded ICC profiles regardless of QCMS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add plumbing through to ImageFrame Created 4 years, 4 months 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 0a73a82315b20919cba52da038188b0b239400be..5633972aaa64b0be9c48f7fb3684d5dd04c2782e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -91,7 +91,7 @@ public:
enum GammaAndColorProfileOption {
GammaAndColorProfileApplied,
- GammaAndColorProfileIgnored
+ GammaAndColorProfileNotApplied
Justin Novosad 2016/08/02 22:49:13 You still need to keep the "Ignore" option IMHO.
};
enum class SniffResult {
@@ -111,11 +111,8 @@ public:
ImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOptions, size_t maxDecodedBytes)
: m_premultiplyAlpha(alphaOption == AlphaPremultiplied)
- , m_ignoreGammaAndColorProfile(colorOptions == GammaAndColorProfileIgnored)
, m_maxDecodedBytes(maxDecodedBytes)
- , m_sizeAvailable(false)
- , m_isAllDataReceived(false)
- , m_failed(false) { }
+ , m_bakeColorTransformToPixels(colorOptions == GammaAndColorProfileApplied) { }
virtual ~ImageDecoder() { }
@@ -231,14 +228,17 @@ public:
ImageOrientation orientation() const { return m_orientation; }
- void setIgnoreGammaAndColorProfile(bool flag) { m_ignoreGammaAndColorProfile = flag; }
- bool ignoresGammaAndColorProfile() const { return m_ignoreGammaAndColorProfile; }
-
static void setTargetColorProfile(const WebVector<char>&);
- bool hasColorProfile() const;
+
+ // Note that hasColorProfile refers to the existence of an 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; }
+ void setColorProfileAndComputeTransform(const char* iccData, unsigned iccLength, bool hasAlpha, bool useSRGB);
#if USE(QCMSLIB)
- void setColorProfileAndTransform(const char* iccData, unsigned iccLength, bool hasAlpha, bool useSRGB);
+ // In contrast with hasColorProfile, this refers to the transform that has
+ // been baked into the pixels.
qcms_transform* colorTransform() { return m_sourceToOutputDeviceColorTransform.get(); }
#endif
@@ -315,10 +315,12 @@ protected:
// Decodes the requested frame.
virtual void decode(size_t) = 0;
+ // Returns the embedded image color profile.
+ const ImageFrame::ICCProfile& colorProfile() const { return m_colorProfile; }
+
RefPtr<SegmentReader> m_data; // The encoded data.
Vector<ImageFrame, 1> m_frameBufferCache;
bool m_premultiplyAlpha;
- bool m_ignoreGammaAndColorProfile;
ImageOrientation m_orientation;
// The maximum amount of memory a decoded image should require. Ideally,
@@ -339,9 +341,14 @@ private:
}
IntSize m_size;
- bool m_sizeAvailable;
- bool m_isAllDataReceived;
- bool m_failed;
+ bool m_sizeAvailable = false;
+ bool m_isAllDataReceived = false;
+ bool m_failed = false;
+
+ const bool m_bakeColorTransformToPixels = false;
+
+ bool m_hasColorProfile = false;
+ ImageFrame::ICCProfile m_colorProfile;
#if USE(QCMSLIB)
QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform;

Powered by Google App Engine
This is Rietveld 408576698