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

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

Issue 1796293003: Image decode color: Push color profile from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
index 70de78249db332997998e3edd75e1cd5195529e1..6bb612e633f6bc444dffec96d660bd0be3ead45d 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -269,15 +269,6 @@ size_t ImagePlanes::rowBytes(int i) const
return m_rowBytes[i];
}
-bool ImageDecoder::hasColorProfile() const
-{
-#if USE(QCMSLIB)
- return m_sourceToOutputDeviceColorTransform.get();
-#else
- return false;
-#endif
-}
-
#if USE(QCMSLIB)
namespace {
@@ -331,12 +322,27 @@ void ImageDecoder::setColorProfileAndTransform(const char* iccData, unsigned icc
// Take a lock around initializing and accessing the global device color profile.
SpinLock::Guard guard(gOutputDeviceProfileLock);
- // Initialize the output device profile.
+ // Initialize the output device profile if it has not been received yet.
if (!gOutputDeviceProfile) {
- // FIXME: Add optional ICCv4 support and support for multiple monitors.
- WebVector<char> profile;
- Platform::current()->screenColorProfile(&profile);
+ gOutputDeviceProfile = qcms_profile_sRGB();
+ qcms_profile_precache_output_transform(gOutputDeviceProfile);
+ }
+
+ if (qcms_profile_match(inputProfile.get(), gOutputDeviceProfile))
+ return;
+
+ qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;
+
+ // FIXME: Don't force perceptual intent if the image profile contains an intent.
+ m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputProfile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PERCEPTUAL));
+}
+
+void ImageDecoder::setOutputDeviceColorProfile(const WebVector<char>& profile)
+{
+ SpinLock::Guard guard(gOutputDeviceProfileLock);
+ // FIXME: Only ever accept one color profile for the duration of the process.
+ if (!gOutputDeviceProfile) {
if (!profile.isEmpty())
gOutputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size());
@@ -350,16 +356,24 @@ void ImageDecoder::setColorProfileAndTransform(const char* iccData, unsigned icc
qcms_profile_precache_output_transform(gOutputDeviceProfile);
}
+}
- if (qcms_profile_match(inputProfile.get(), gOutputDeviceProfile))
- return;
+bool ImageDecoder::hasColorProfile() const
+{
+ return m_sourceToOutputDeviceColorTransform.get();
+}
- qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;
+#else // USE(QCMSLIB)
- // FIXME: Don't force perceptual intent if the image profile contains an intent.
- m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputProfile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PERCEPTUAL));
+void ImageDecoder::setOutputDeviceColorProfile(const WebVector<char>& colorProfile)
+{
+}
+
+bool ImageDecoder::hasColorProfile() const
+{
+ return false;
}
-#endif // USE(QCMSLIB)
+#endif // !USE(QCMSLIB)
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698