OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ui/gfx/color_profile.h" |
| 6 |
| 7 #include "base/mac/mac_util.h" |
| 8 |
| 9 namespace gfx { |
| 10 |
| 11 void ReadColorProfile(gfx::NativeViewId parent_window, |
| 12 std::vector<char>* profile) { |
| 13 CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace()); |
| 14 CFDataRef icc_profile(CGColorSpaceCopyICCProfile(monitor_color_space)); |
| 15 if (icc_profile) { |
| 16 size_t length = CFDataGetLength(icc_profile); |
| 17 if (length > MAX_PROFILE_LENGTH) |
| 18 return; |
| 19 if (length < MIN_PROFILE_LENGTH) |
| 20 return; |
| 21 const unsigned char* sys_profile = CFDataGetBytePtr(icc_profile); |
| 22 profile->assign(sys_profile, sys_profile + length); |
| 23 } |
| 24 } |
| 25 |
| 26 } // namespace gfx |
| 27 |
OLD | NEW |