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.
5 #include "ui/gfx/color_profile.h"
7 #import <Cocoa/Cocoa.h>
9 #include "base/mac/mac_util.h"
10 #include "base/mac/scoped_cftyperef.h"
11 #include "ui/gfx/mac/coordinate_conversion.h"
15 void ReadColorProfile(std::vector<char>* profile) {
16 CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace());
17 base::ScopedCFTypeRef<CFDataRef> icc_profile(
18 CGColorSpaceCopyICCProfile(monitor_color_space));
21 size_t length = CFDataGetLength(icc_profile);
22 if (gfx::InvalidColorProfileLength(length))
24 const unsigned char* data = CFDataGetBytePtr(icc_profile);
25 profile->assign(data, data + length);