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

Side by Side Diff: ui/gfx/icc_profile_mac.mm

Issue 2924743002: gfx_unittests builds on 10.13 (Closed)
Patch Set: Created 3 years, 6 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 | ui/gfx/mac/io_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/icc_profile.h" 5 #include "ui/gfx/icc_profile.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 11
12 // static 12 // static
13 ICCProfile ICCProfile::FromBestMonitor() { 13 ICCProfile ICCProfile::FromBestMonitor() {
14 return FromCGColorSpace(base::mac::GetSystemColorSpace()); 14 return FromCGColorSpace(base::mac::GetSystemColorSpace());
15 } 15 }
16 16
17 // static 17 // static
18 ICCProfile ICCProfile::FromCGColorSpace(CGColorSpaceRef cg_color_space) { 18 ICCProfile ICCProfile::FromCGColorSpace(CGColorSpaceRef cg_color_space) {
19 if (HasForcedProfile()) 19 if (HasForcedProfile())
20 return GetForcedProfile(); 20 return GetForcedProfile();
21 21
22 base::ScopedCFTypeRef<CFDataRef> cf_icc_profile( 22 base::ScopedCFTypeRef<CFDataRef> cf_icc_profile;
23 CGColorSpaceCopyICCProfile(cg_color_space)); 23 if (__builtin_available(macOS 10.12, *)) {
24 cf_icc_profile.reset(CGColorSpaceCopyICCProfile(cg_color_space));
25 }
24 if (!cf_icc_profile) 26 if (!cf_icc_profile)
25 return gfx::ICCProfile(); 27 return gfx::ICCProfile();
26 size_t length = CFDataGetLength(cf_icc_profile); 28 size_t length = CFDataGetLength(cf_icc_profile);
27 const unsigned char* data = CFDataGetBytePtr(cf_icc_profile); 29 const unsigned char* data = CFDataGetBytePtr(cf_icc_profile);
28 std::vector<char> vector_icc_profile; 30 std::vector<char> vector_icc_profile;
29 vector_icc_profile.assign(data, data + length); 31 vector_icc_profile.assign(data, data + length);
30 return FromData(vector_icc_profile.data(), vector_icc_profile.size()); 32 return FromData(vector_icc_profile.data(), vector_icc_profile.size());
31 } 33 }
32 34
33 } // namespace gfx 35 } // namespace gfx
36
37 extern "C" {
38
39 // This does not belong here..
40 int32_t __isOSVersionAtLeast(int32_t Major, int32_t Minor, int32_t Subminor) {
41 return 0;
42 }
43 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/mac/io_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698