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

Side by Side Diff: Source/platform/image-decoders/ImageDecoder.h

Issue 554033002: [Mac] Add a new WebSandboxSupport method to get the display's color space. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change approach Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 #include "platform/graphics/ImageSource.h" 34 #include "platform/graphics/ImageSource.h"
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)
45 #include <ApplicationServices/ApplicationServices.h>
46 #include "wtf/RetainPtr.h"
47 #endif
48 #endif 44 #endif
49 45
50 namespace blink { 46 namespace blink {
51 47
52 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame. 48 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame.
53 class PLATFORM_EXPORT ImagePlanes { 49 class PLATFORM_EXPORT ImagePlanes {
54 public: 50 public:
55 ImagePlanes(); 51 ImagePlanes();
56 ImagePlanes(void* planes[3], size_t rowBytes[3]); 52 ImagePlanes(void* planes[3], size_t rowBytes[3]);
57 53
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 188
193 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4); 189 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4);
194 } 190 }
195 191
196 class OutputDeviceProfile { 192 class OutputDeviceProfile {
197 public: 193 public:
198 OutputDeviceProfile() 194 OutputDeviceProfile()
199 : m_outputDeviceProfile(0) 195 : m_outputDeviceProfile(0)
200 { 196 {
201 // FIXME: Add optional ICCv4 support. 197 // FIXME: Add optional ICCv4 support.
202 #if OS(MACOSX)
203 RetainPtr<CGColorSpaceRef> monitorColorSpace(AdoptCF, CGDisplayCopyC olorSpace(CGMainDisplayID()));
204 CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace.ge t()));
205 if (iccProfile) {
206 size_t length = CFDataGetLength(iccProfile);
207 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile );
208 m_outputDeviceProfile = qcms_profile_from_memory(systemProfile, length);
209 CFRelease(iccProfile);
210 }
211 #else
212 // FIXME: add support for multiple monitors. 198 // FIXME: add support for multiple monitors.
213 ColorProfile profile; 199 ColorProfile profile;
214 screenColorProfile(profile); 200 screenColorProfile(profile);
215 if (!profile.isEmpty()) 201 if (!profile.isEmpty())
216 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); 202 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size());
217 #endif
218 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) { 203 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) {
219 qcms_profile_release(m_outputDeviceProfile); 204 qcms_profile_release(m_outputDeviceProfile);
220 m_outputDeviceProfile = 0; 205 m_outputDeviceProfile = 0;
221 } 206 }
222 if (!m_outputDeviceProfile) 207 if (!m_outputDeviceProfile)
223 m_outputDeviceProfile = qcms_profile_sRGB(); 208 m_outputDeviceProfile = qcms_profile_sRGB();
224 if (m_outputDeviceProfile) 209 if (m_outputDeviceProfile)
225 qcms_profile_precache_output_transform(m_outputDeviceProfile); 210 qcms_profile_precache_output_transform(m_outputDeviceProfile);
226 } 211 }
227 212
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 308
324 IntSize m_size; 309 IntSize m_size;
325 bool m_sizeAvailable; 310 bool m_sizeAvailable;
326 bool m_isAllDataReceived; 311 bool m_isAllDataReceived;
327 bool m_failed; 312 bool m_failed;
328 }; 313 };
329 314
330 } // namespace blink 315 } // namespace blink
331 316
332 #endif 317 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698