diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h index 2ba18ae2cc9..f3904532222 100644 --- a/chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h +++ b/chromium/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h @@ -43,7 +43,6 @@ #include "qcms.h" #if OS(MACOSX) #include <ApplicationServices/ApplicationServices.h> -#include "platform/graphics/cg/GraphicsContextCG.h" #include "wtf/RetainPtr.h" #endif #endif @@ -148,11 +147,16 @@ public: // Number of bytes in the decoded frame requested. Return 0 if not yet decoded. virtual unsigned frameBytesAtIndex(size_t) const; + ImageOrientation orientation() const { return m_orientation; } + + static bool deferredImageDecodingEnabled(); + void setIgnoreGammaAndColorProfile(bool flag) { m_ignoreGammaAndColorProfile = flag; } bool ignoresGammaAndColorProfile() const { return m_ignoreGammaAndColorProfile; } - ImageOrientation orientation() const { return m_orientation; } + virtual bool hasColorProfile() const { return false; } +#if USE(QCMSLIB) enum { iccColorProfileHeaderLength = 128 }; static bool rgbColorProfile(const char* profileData, unsigned profileLength) @@ -169,14 +173,11 @@ public: return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4); } -#if USE(QCMSLIB) - static qcms_profile* qcmsOutputDeviceProfile() - { - static qcms_profile* outputDeviceProfile = 0; - - static bool qcmsInitialized = false; - if (!qcmsInitialized) { - qcmsInitialized = true; + class OutputDeviceProfile { + public: + OutputDeviceProfile() + : m_outputDeviceProfile(0) + { // FIXME: Add optional ICCv4 support. #if OS(MACOSX) RetainPtr<CGColorSpaceRef> monitorColorSpace(AdoptCF, CGDisplayCopyColorSpace(CGMainDisplayID())); @@ -184,25 +185,36 @@ public: if (iccProfile) { size_t length = CFDataGetLength(iccProfile); const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile); - outputDeviceProfile = qcms_profile_from_memory(systemProfile, length); + m_outputDeviceProfile = qcms_profile_from_memory(systemProfile, length); } #else // FIXME: add support for multiple monitors. ColorProfile profile; screenColorProfile(profile); if (!profile.isEmpty()) - outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); + m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); #endif - if (outputDeviceProfile && qcms_profile_is_bogus(outputDeviceProfile)) { - qcms_profile_release(outputDeviceProfile); - outputDeviceProfile = 0; + if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDeviceProfile)) { + qcms_profile_release(m_outputDeviceProfile); + m_outputDeviceProfile = 0; } - if (!outputDeviceProfile) - outputDeviceProfile = qcms_profile_sRGB(); - if (outputDeviceProfile) - qcms_profile_precache_output_transform(outputDeviceProfile); + if (!m_outputDeviceProfile) + m_outputDeviceProfile = qcms_profile_sRGB(); + if (m_outputDeviceProfile) + qcms_profile_precache_output_transform(m_outputDeviceProfile); } - return outputDeviceProfile; + + qcms_profile* profile() const { return m_outputDeviceProfile; } + + private: + qcms_profile* m_outputDeviceProfile; + }; + + static qcms_profile* qcmsOutputDeviceProfile() + { + AtomicallyInitializedStatic(OutputDeviceProfile*, outputDeviceProfile = new OutputDeviceProfile()); + + return outputDeviceProfile->profile(); } #endif |