Disable ExtensionIconSourceTest.IconLoaded* on Mac and Win
[chromium-blink-merge.git] / ui / gfx / color_profile_mac.cc
blobc313745c07628e4548d1daa984abf7b2d7660a1f
1 // Copyright (c) 2012 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 #include "base/mac/mac_util.h"
9 namespace gfx {
11 void ReadColorProfile(std::vector<char>* profile) {
12 CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace());
13 base::mac::ScopedCFTypeRef<CFDataRef> icc_profile(
14 CGColorSpaceCopyICCProfile(monitor_color_space));
15 if (icc_profile) {
16 size_t length = CFDataGetLength(icc_profile);
17 if (length > gfx::kMaxProfileLength)
18 return;
19 if (length < gfx::kMinProfileLength)
20 return;
21 const unsigned char* sys_profile = CFDataGetBytePtr(icc_profile);
22 profile->assign(sys_profile, sys_profile + length);
26 } // namespace gfx