Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / gfx / color_profile_mac.mm
blobc36072d93308cee51a90ff71121c3201c9e84dcf
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 #include "base/mac/mac_util.h"
9 namespace gfx {
11 bool GetDisplayColorProfile(const gfx::Rect& bounds,
12                             std::vector<char>* profile) {
13   if (bounds.IsEmpty())
14     return false;
15   // TODO(noel): implement.
16   return false;
19 void ReadColorProfile(std::vector<char>* profile) {
20   CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace());
21   base::ScopedCFTypeRef<CFDataRef> icc_profile(
22       CGColorSpaceCopyICCProfile(monitor_color_space));
23   if (!icc_profile)
24     return;
25   size_t length = CFDataGetLength(icc_profile);
26   if (gfx::InvalidColorProfileLength(length))
27     return;
28   const unsigned char* data = CFDataGetBytePtr(icc_profile);
29   profile->assign(data, data + length);
32 }  // namespace gfx