Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6757)

Unified Diff: base/mac_util.mm

Issue 194096: For the purposes of the "system color space," use the main display's color space (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac_util.mm
===================================================================
--- base/mac_util.mm (revision 26002)
+++ base/mac_util.mm (working copy)
@@ -108,24 +108,28 @@
// 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698