From 2b7c2bfe5c2459f3581619042ea405d16300c00b Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Sun, 13 Sep 2009 15:01:13 +0000 Subject: 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 --- base/mac_util.mm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'base/mac_util.mm') 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; } -- cgit v1.1