Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "platform/image-decoders/ImageFrame.h" | 35 #include "platform/image-decoders/ImageFrame.h" |
| 36 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
| 37 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 41 | 41 |
| 42 #if USE(QCMSLIB) | 42 #if USE(QCMSLIB) |
| 43 #include "qcms.h" | 43 #include "qcms.h" |
| 44 #if OS(MACOSX) | 44 #if OS(MACOSX) |
| 45 #include "public/platform/mac/WebSandboxSupport.h" | |
| 45 #include <ApplicationServices/ApplicationServices.h> | 46 #include <ApplicationServices/ApplicationServices.h> |
| 46 #include "wtf/RetainPtr.h" | |
| 47 #endif | 47 #endif |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame. | 52 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame. |
| 53 class PLATFORM_EXPORT ImagePlanes { | 53 class PLATFORM_EXPORT ImagePlanes { |
| 54 public: | 54 public: |
| 55 ImagePlanes(); | 55 ImagePlanes(); |
| 56 ImagePlanes(void* planes[3], size_t rowBytes[3]); | 56 ImagePlanes(void* planes[3], size_t rowBytes[3]); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4); | 193 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4); |
| 194 } | 194 } |
| 195 | 195 |
| 196 class OutputDeviceProfile { | 196 class OutputDeviceProfile { |
| 197 public: | 197 public: |
| 198 OutputDeviceProfile() | 198 OutputDeviceProfile() |
| 199 : m_outputDeviceProfile(0) | 199 : m_outputDeviceProfile(0) |
| 200 { | 200 { |
| 201 // FIXME: Add optional ICCv4 support. | 201 // FIXME: Add optional ICCv4 support. |
| 202 #if OS(MACOSX) | 202 #if OS(MACOSX) |
| 203 RetainPtr<CGColorSpaceRef> monitorColorSpace(AdoptCF, CGDisplayCopyC olorSpace(CGMainDisplayID())); | 203 CGColorSpaceRef monitorColorSpace = Platform::current()->sandboxSupp ort()->displayColorSpace(); |
|
Noel Gordon
2014/09/10 08:46:27
As asked on the other review, is this thread-safe?
| |
| 204 CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace.ge t())); | 204 CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace)); |
| 205 if (iccProfile) { | 205 if (iccProfile) { |
| 206 size_t length = CFDataGetLength(iccProfile); | 206 size_t length = CFDataGetLength(iccProfile); |
| 207 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile ); | 207 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile ); |
| 208 m_outputDeviceProfile = qcms_profile_from_memory(systemProfile, length); | 208 m_outputDeviceProfile = qcms_profile_from_memory(systemProfile, length); |
| 209 CFRelease(iccProfile); | 209 CFRelease(iccProfile); |
| 210 } | 210 } |
| 211 #else | 211 #else |
| 212 // FIXME: add support for multiple monitors. | 212 // FIXME: add support for multiple monitors. |
| 213 ColorProfile profile; | 213 ColorProfile profile; |
| 214 screenColorProfile(profile); | 214 screenColorProfile(profile); |
|
Noel Gordon
2014/09/10 08:46:27
This finds its way to your https://codereview.chr
| |
| 215 if (!profile.isEmpty()) | 215 if (!profile.isEmpty()) |
| 216 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); | 216 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); |
| 217 #endif | 217 #endif |
| 218 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) { | 218 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) { |
| 219 qcms_profile_release(m_outputDeviceProfile); | 219 qcms_profile_release(m_outputDeviceProfile); |
| 220 m_outputDeviceProfile = 0; | 220 m_outputDeviceProfile = 0; |
| 221 } | 221 } |
| 222 if (!m_outputDeviceProfile) | 222 if (!m_outputDeviceProfile) |
| 223 m_outputDeviceProfile = qcms_profile_sRGB(); | 223 m_outputDeviceProfile = qcms_profile_sRGB(); |
| 224 if (m_outputDeviceProfile) | 224 if (m_outputDeviceProfile) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 | 323 |
| 324 IntSize m_size; | 324 IntSize m_size; |
| 325 bool m_sizeAvailable; | 325 bool m_sizeAvailable; |
| 326 bool m_isAllDataReceived; | 326 bool m_isAllDataReceived; |
| 327 bool m_failed; | 327 bool m_failed; |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 } // namespace blink | 330 } // namespace blink |
| 331 | 331 |
| 332 #endif | 332 #endif |
| OLD | NEW |