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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 | 43 |
44 #if USE(QCMSLIB) | 44 #if USE(QCMSLIB) |
45 #include "qcms.h" | 45 #include "qcms.h" |
46 #endif | 46 #endif |
47 | 47 |
48 typedef Vector<char> ColorProfile; | 48 typedef Vector<char> ColorProfile; |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
| 52 #if USE(QCMSLIB) |
| 53 enum ColorProfileStatus { |
| 54 ColorProfileNone = 0, |
| 55 ColorProfileNotFound = 1, // A profile was expected but could not be retriev
ed |
| 56 ColorProfileIsCorrupted = 2, |
| 57 ColorProfileIsNotRGB = 3, |
| 58 ColorProfileIsNotAnInputProfile = 4, |
| 59 ColorProfileIsV4 = 5, |
| 60 ColorProfileFailedDecode = 6, |
| 61 ColorProfileIsBogus = 7, |
| 62 ColorProfileSuccess = 8, |
| 63 ColorProfileSuccess_PNGsRGB = 9, // Using built-in sRGB tag (no actual embed
ded profile) |
| 64 ValueCount = 10 |
| 65 }; |
| 66 #endif |
| 67 |
52 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. | 68 // ImagePlanes can be used to decode color components into provided buffers inst
ead of using an ImageFrame. |
53 class PLATFORM_EXPORT ImagePlanes { | 69 class PLATFORM_EXPORT ImagePlanes { |
54 public: | 70 public: |
55 ImagePlanes(); | 71 ImagePlanes(); |
56 ImagePlanes(void* planes[3], size_t rowBytes[3]); | 72 ImagePlanes(void* planes[3], size_t rowBytes[3]); |
57 | 73 |
58 void* plane(int); | 74 void* plane(int); |
59 size_t rowBytes(int) const; | 75 size_t rowBytes(int) const; |
60 | 76 |
61 private: | 77 private: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return !memcmp(&profileData[16], "RGB ", 4); | 221 return !memcmp(&profileData[16], "RGB ", 4); |
206 } | 222 } |
207 | 223 |
208 static bool inputDeviceColorProfile(const char* profileData, unsigned profil
eLength) | 224 static bool inputDeviceColorProfile(const char* profileData, unsigned profil
eLength) |
209 { | 225 { |
210 ASSERT_UNUSED(profileLength, profileLength >= iccColorProfileHeaderLengt
h); | 226 ASSERT_UNUSED(profileLength, profileLength >= iccColorProfileHeaderLengt
h); |
211 | 227 |
212 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12],
"scnr", 4); | 228 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12],
"scnr", 4); |
213 } | 229 } |
214 | 230 |
| 231 static bool isICCv4(const char* profileData, unsigned profileLength) |
| 232 { |
| 233 ASSERT_UNUSED(profileLength, profileLength >= iccColorProfileHeaderLengt
h); |
| 234 |
| 235 return profileData[8] == 4; |
| 236 } |
| 237 |
215 class OutputDeviceProfile { | 238 class OutputDeviceProfile { |
216 public: | 239 public: |
217 OutputDeviceProfile() | 240 OutputDeviceProfile(); |
218 : m_outputDeviceProfile(0) | |
219 { | |
220 ColorProfile profile = screenColorProfile(); | |
221 if (!profile.isEmpty()) | |
222 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(),
profile.size()); | |
223 | |
224 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro
file)) { | |
225 qcms_profile_release(m_outputDeviceProfile); | |
226 m_outputDeviceProfile = 0; | |
227 } | |
228 | |
229 if (!m_outputDeviceProfile) | |
230 m_outputDeviceProfile = qcms_profile_sRGB(); | |
231 if (m_outputDeviceProfile) | |
232 qcms_profile_precache_output_transform(m_outputDeviceProfile); | |
233 } | |
234 | 241 |
235 qcms_profile* profile() const { return m_outputDeviceProfile; } | 242 qcms_profile* profile() const { return m_outputDeviceProfile; } |
236 | 243 |
237 private: | 244 private: |
238 static ColorProfile screenColorProfile() | 245 static ColorProfile screenColorProfile() |
239 { | 246 { |
240 // FIXME: Add optional ICCv4 support and support for multiple monito
rs. | 247 // FIXME: Add optional ICCv4 support and support for multiple monito
rs. |
241 WebVector<char> profile; | 248 WebVector<char> profile; |
242 Platform::current()->screenColorProfile(&profile); | 249 Platform::current()->screenColorProfile(&profile); |
243 | 250 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 362 |
356 IntSize m_size; | 363 IntSize m_size; |
357 bool m_sizeAvailable; | 364 bool m_sizeAvailable; |
358 bool m_isAllDataReceived; | 365 bool m_isAllDataReceived; |
359 bool m_failed; | 366 bool m_failed; |
360 }; | 367 }; |
361 | 368 |
362 } // namespace blink | 369 } // namespace blink |
363 | 370 |
364 #endif | 371 #endif |
OLD | NEW |