summaryrefslogtreecommitdiffstats
path: root/base/mac_util.mm
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-13 15:01:13 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-13 15:01:13 +0000
commit2b7c2bfe5c2459f3581619042ea405d16300c00b (patch)
treeab68aed6512a0a234c33d30a3f22bbbd600ddf6d /base/mac_util.mm
parent72df4df1ebef2bb6b8d29dc4b9800c67ad05009b (diff)
downloadchromium_src-2b7c2bfe5c2459f3581619042ea405d16300c00b.zip
chromium_src-2b7c2bfe5c2459f3581619042ea405d16300c00b.tar.gz
chromium_src-2b7c2bfe5c2459f3581619042ea405d16300c00b.tar.bz2
For the purposes of the "system color space," use the main display's color
space instead of a color space derived from the apparently unreliable system ColorSync profile setting. BUG=21658 TEST=Rendering works on Nico's girlfriend's laptop Review URL: http://codereview.chromium.org/194096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util.mm')
-rw-r--r--base/mac_util.mm22
1 files changed, 13 insertions, 9 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm
index ea43d11..2aa86f2 100644
--- a/base/mac_util.mm
+++ b/base/mac_util.mm
@@ -108,24 +108,28 @@ CGColorSpaceRef GetSRGBColorSpace() {
// Leaked. That's OK, it's scoped to the lifetime of the application.
static CGColorSpaceRef g_color_space_sRGB =
CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ LOG_IF(ERROR, !g_color_space_sRGB) << "Couldn't get the sRGB color space";
return g_color_space_sRGB;
}
CGColorSpaceRef GetSystemColorSpace() {
// Leaked. That's OK, it's scoped to the lifetime of the application.
- static CGColorSpaceRef g_system_color_space = NULL;
+ // Try to get the main display's color space.
+ static CGColorSpaceRef g_system_color_space =
+ CGDisplayCopyColorSpace(CGMainDisplayID());
if (!g_system_color_space) {
- // Get the System Profile for the main display
- CMProfileRef system_profile = NULL;
- if (CMGetSystemProfile(&system_profile) == noErr) {
- // Create a colorspace with the system profile
- g_system_color_space =
- CGColorSpaceCreateWithPlatformColorSpace(system_profile);
- // Close the profile
- CMCloseProfile(system_profile);
+ // Use a generic RGB color space. This is better than nothing.
+ g_system_color_space = CGColorSpaceCreateDeviceRGB();
+
+ if (g_system_color_space) {
+ LOG(WARNING) <<
+ "Couldn't get the main display's color space, using generic";
+ } else {
+ LOG(ERROR) << "Couldn't get any color space";
}
}
+
return g_system_color_space;
}