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

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

Issue 2161293002: Color: Separate ICCProfile and ColorSpace structures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporate review feedback Created 4 years, 4 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 | « ui/gfx/icc_profile.cc ('k') | ui/gfx/icc_profile_win.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/color_space.h" 5 #include "ui/gfx/icc_profile.h"
6
7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h>
9 6
10 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
11 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
12 #include "ui/gfx/mac/coordinate_conversion.h"
13 9
14 namespace gfx { 10 namespace gfx {
15 11
16 // static 12 // static
17 ColorSpace ColorSpace::FromBestMonitor() { 13 ICCProfile ICCProfile::FromBestMonitor() {
18 return FromCGColorSpace(base::mac::GetSystemColorSpace()); 14 return FromCGColorSpace(base::mac::GetSystemColorSpace());
19 } 15 }
20 16
21 // static 17 // static
22 ColorSpace ColorSpace::FromCGColorSpace(CGColorSpaceRef cg_color_space) { 18 ICCProfile ICCProfile::FromCGColorSpace(CGColorSpaceRef cg_color_space) {
23 base::ScopedCFTypeRef<CFDataRef> cf_icc_profile( 19 base::ScopedCFTypeRef<CFDataRef> cf_icc_profile(
24 CGColorSpaceCopyICCProfile(cg_color_space)); 20 CGColorSpaceCopyICCProfile(cg_color_space));
25 if (!cf_icc_profile) 21 if (!cf_icc_profile)
26 return gfx::ColorSpace(); 22 return gfx::ICCProfile();
27 size_t length = CFDataGetLength(cf_icc_profile); 23 size_t length = CFDataGetLength(cf_icc_profile);
28 const unsigned char* data = CFDataGetBytePtr(cf_icc_profile); 24 const unsigned char* data = CFDataGetBytePtr(cf_icc_profile);
29 std::vector<char> vector_icc_profile; 25 std::vector<char> vector_icc_profile;
30 vector_icc_profile.assign(data, data + length); 26 vector_icc_profile.assign(data, data + length);
31 return FromICCProfile(vector_icc_profile); 27 return FromData(vector_icc_profile);
32 } 28 }
33 29
34 } // namespace gfx 30 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icc_profile.cc ('k') | ui/gfx/icc_profile_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698