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

Side by Side Diff: ui/display/mac/screen_mac.mm

Issue 2950183002: color: Use ICCProfile from display::Display instead of FromBestMonitor (Closed)
Patch Set: Use forced color profile in display::Display ctor Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/display/display.cc ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/display/screen.h" 5 #include "ui/display/screen.h"
6 6
7 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/mac/mac_util.h" 16 #include "base/mac/mac_util.h"
17 #include "base/mac/sdk_forward_declarations.h" 17 #include "base/mac/sdk_forward_declarations.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "ui/display/display.h" 20 #include "ui/display/display.h"
21 #include "ui/display/display_change_notifier.h" 21 #include "ui/display/display_change_notifier.h"
22 #include "ui/gfx/color_space_switches.h" 22 #include "ui/gfx/color_space_switches.h"
23 #include "ui/gfx/icc_profile.h"
23 #include "ui/gfx/mac/coordinate_conversion.h" 24 #include "ui/gfx/mac/coordinate_conversion.h"
24 25
25 extern "C" { 26 extern "C" {
26 Boolean CGDisplayUsesForceToGray(void); 27 Boolean CGDisplayUsesForceToGray(void);
27 } 28 }
28 29
29 namespace display { 30 namespace display {
30 namespace { 31 namespace {
31 32
32 // The delay to handle the display configuration changes. 33 // The delay to handle the display configuration changes.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 // On Sierra, we need to operate in a single screen's color space because 83 // On Sierra, we need to operate in a single screen's color space because
83 // IOSurfaces do not opt-out of color correction. 84 // IOSurfaces do not opt-out of color correction.
84 // https://crbug.com/654488 85 // https://crbug.com/654488
85 CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace]; 86 CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace];
86 static bool color_correct_rendering_enabled = 87 static bool color_correct_rendering_enabled =
87 base::FeatureList::IsEnabled(features::kColorCorrectRendering); 88 base::FeatureList::IsEnabled(features::kColorCorrectRendering);
88 if (base::mac::IsAtLeastOS10_12() && !color_correct_rendering_enabled) 89 if (base::mac::IsAtLeastOS10_12() && !color_correct_rendering_enabled)
89 color_space = base::mac::GetSystemColorSpace(); 90 color_space = base::mac::GetSystemColorSpace();
90 91
91 display.set_icc_profile(gfx::ICCProfile::FromCGColorSpace(color_space)); 92 display.set_color_space(
93 gfx::ICCProfile::FromCGColorSpace(color_space).GetColorSpace());
92 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); 94 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth]));
93 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); 95 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth]));
94 display.set_is_monochrome(CGDisplayUsesForceToGray()); 96 display.set_is_monochrome(CGDisplayUsesForceToGray());
95 97
96 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will 98 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will
97 // handle the unexpected situations were the angle is not a multiple of 90. 99 // handle the unexpected situations were the angle is not a multiple of 90.
98 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); 100 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id)));
99 return display; 101 return display;
100 } 102 }
101 103
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return window; 346 return window;
345 } 347 }
346 348
347 #if !defined(USE_AURA) 349 #if !defined(USE_AURA)
348 Screen* CreateNativeScreen() { 350 Screen* CreateNativeScreen() {
349 return new ScreenMac; 351 return new ScreenMac;
350 } 352 }
351 #endif 353 #endif
352 354
353 } // namespace display 355 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display.cc ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698