OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/color_profile.h" | |
6 | |
7 #import <Cocoa/Cocoa.h> | |
8 #include <stddef.h> | |
9 | |
10 #include "base/mac/mac_util.h" | |
11 #include "base/mac/scoped_cftyperef.h" | |
12 #include "ui/gfx/mac/coordinate_conversion.h" | |
13 | |
14 namespace gfx { | |
15 | |
16 // static | |
17 ColorProfile ColorProfile::GetFromBestMonitor() { | |
18 ColorProfile profile; | |
19 CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace()); | |
20 base::ScopedCFTypeRef<CFDataRef> icc_profile( | |
21 CGColorSpaceCopyICCProfile(monitor_color_space)); | |
22 if (!icc_profile) | |
23 return profile; | |
24 size_t length = CFDataGetLength(icc_profile); | |
25 if (!IsValidProfileLength(length)) | |
26 return profile; | |
27 const unsigned char* data = CFDataGetBytePtr(icc_profile); | |
28 profile.profile_.assign(data, data + length); | |
29 return profile; | |
30 } | |
31 | |
32 } // namespace gfx | |
OLD | NEW |