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

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

Issue 570023002: Move screenColorProfile from Platform to ImageDecoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: RVO: make screenColorProfile return the ColorProfile. 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/PlatformScreen.cpp ('k') | 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 25 matching lines...) Expand all
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 #endif 44 #endif
45 45
46 typedef Vector<char> ColorProfile;
Mike West 2014/09/15 07:12:16 It looks this type is only used in the OutputDevic
Noel Gordon 2014/09/15 07:27:17 Yeah, it's needed in (JPEG|PNG|WEBP)ImageDecoder f
47
46 namespace blink { 48 namespace blink {
47 49
48 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame. 50 // ImagePlanes can be used to decode color components into provided buffers inst ead of using an ImageFrame.
49 class PLATFORM_EXPORT ImagePlanes { 51 class PLATFORM_EXPORT ImagePlanes {
50 public: 52 public:
51 ImagePlanes(); 53 ImagePlanes();
52 ImagePlanes(void* planes[3], size_t rowBytes[3]); 54 ImagePlanes(void* planes[3], size_t rowBytes[3]);
53 55
54 void* plane(int); 56 void* plane(int);
55 size_t rowBytes(int) const; 57 size_t rowBytes(int) const;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT_UNUSED(profileLength, profileLength >= iccColorProfileHeaderLengt h); 191 ASSERT_UNUSED(profileLength, profileLength >= iccColorProfileHeaderLengt h);
190 192
191 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4); 193 return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4);
192 } 194 }
193 195
194 class OutputDeviceProfile { 196 class OutputDeviceProfile {
195 public: 197 public:
196 OutputDeviceProfile() 198 OutputDeviceProfile()
197 : m_outputDeviceProfile(0) 199 : m_outputDeviceProfile(0)
198 { 200 {
199 // FIXME: Add optional ICCv4 support. 201 ColorProfile profile = screenColorProfile();
200 // FIXME: add support for multiple monitors.
201 ColorProfile profile;
202 screenColorProfile(profile);
203 if (!profile.isEmpty()) 202 if (!profile.isEmpty())
204 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); 203 m_outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size());
204
205 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) { 205 if (m_outputDeviceProfile && qcms_profile_is_bogus(m_outputDevicePro file)) {
206 qcms_profile_release(m_outputDeviceProfile); 206 qcms_profile_release(m_outputDeviceProfile);
207 m_outputDeviceProfile = 0; 207 m_outputDeviceProfile = 0;
208 } 208 }
209
209 if (!m_outputDeviceProfile) 210 if (!m_outputDeviceProfile)
210 m_outputDeviceProfile = qcms_profile_sRGB(); 211 m_outputDeviceProfile = qcms_profile_sRGB();
211 if (m_outputDeviceProfile) 212 if (m_outputDeviceProfile)
212 qcms_profile_precache_output_transform(m_outputDeviceProfile); 213 qcms_profile_precache_output_transform(m_outputDeviceProfile);
213 } 214 }
214 215
215 qcms_profile* profile() const { return m_outputDeviceProfile; } 216 qcms_profile* profile() const { return m_outputDeviceProfile; }
216 217
217 private: 218 private:
219 static ColorProfile screenColorProfile()
220 {
221 // FIXME: Add optional ICCv4 support and support for multiple monito rs.
Mike West 2014/09/15 07:12:16 Nit: Is there a bug filed for this FIXME? It'd be
Noel Gordon 2014/09/15 07:27:17 https://crbug.com/353818 and I know the bug well.
222 WebVector<char> profile;
223 Platform::current()->screenColorProfile(&profile);
224
225 ColorProfile colorProfile;
226 colorProfile.append(profile.data(), profile.size());
jochen (gone - plz use gerrit) 2014/09/15 12:46:02 Why not just use the WebVector<>? You now copy the
Noel Gordon 2014/09/15 12:55:53 The data was copied twice before this change (refe
227 return colorProfile;
228 }
229
218 qcms_profile* m_outputDeviceProfile; 230 qcms_profile* m_outputDeviceProfile;
219 }; 231 };
220 232
221 static qcms_profile* qcmsOutputDeviceProfile() 233 static qcms_profile* qcmsOutputDeviceProfile()
222 { 234 {
223 AtomicallyInitializedStatic(OutputDeviceProfile*, outputDeviceProfile = new OutputDeviceProfile()); 235 AtomicallyInitializedStatic(OutputDeviceProfile*, outputDeviceProfile = new OutputDeviceProfile());
224 236
225 return outputDeviceProfile->profile(); 237 return outputDeviceProfile->profile();
226 } 238 }
227 #endif 239 #endif
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 322
311 IntSize m_size; 323 IntSize m_size;
312 bool m_sizeAvailable; 324 bool m_sizeAvailable;
313 bool m_isAllDataReceived; 325 bool m_isAllDataReceived;
314 bool m_failed; 326 bool m_failed;
315 }; 327 };
316 328
317 } // namespace blink 329 } // namespace blink
318 330
319 #endif 331 #endif
OLDNEW
« no previous file with comments | « Source/platform/PlatformScreen.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698