| 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
|
|
|