OLD | NEW |
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/logging.h" | 15 #include "base/logging.h" |
15 #include "base/mac/mac_util.h" | 16 #include "base/mac/mac_util.h" |
16 #include "base/mac/sdk_forward_declarations.h" | 17 #include "base/mac/sdk_forward_declarations.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
19 #include "ui/display/display.h" | 20 #include "ui/display/display.h" |
20 #include "ui/display/display_change_notifier.h" | 21 #include "ui/display/display_change_notifier.h" |
21 #include "ui/gfx/mac/coordinate_conversion.h" | 22 #include "ui/gfx/mac/coordinate_conversion.h" |
| 23 #include "ui/gfx/switches.h" |
22 | 24 |
23 extern "C" { | 25 extern "C" { |
24 Boolean CGDisplayUsesForceToGray(void); | 26 Boolean CGDisplayUsesForceToGray(void); |
25 } | 27 } |
26 | 28 |
27 namespace display { | 29 namespace display { |
28 namespace { | 30 namespace { |
29 | 31 |
30 // The delay to handle the display configuration changes. | 32 // The delay to handle the display configuration changes. |
31 // See comments in ScreenMac::HandleDisplayReconfiguration. | 33 // See comments in ScreenMac::HandleDisplayReconfiguration. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 76 |
75 if (Display::HasForceDeviceScaleFactor()) | 77 if (Display::HasForceDeviceScaleFactor()) |
76 scale = Display::GetForcedDeviceScaleFactor(); | 78 scale = Display::GetForcedDeviceScaleFactor(); |
77 | 79 |
78 display.set_device_scale_factor(scale); | 80 display.set_device_scale_factor(scale); |
79 | 81 |
80 // On Sierra, we need to operate in a single screen's color space because | 82 // On Sierra, we need to operate in a single screen's color space because |
81 // IOSurfaces do not opt-out of color correction. | 83 // IOSurfaces do not opt-out of color correction. |
82 // https://crbug.com/654488 | 84 // https://crbug.com/654488 |
83 CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace]; | 85 CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace]; |
84 if (base::mac::IsAtLeastOS10_12()) | 86 static bool color_correct_rendering_enabled = |
| 87 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 88 switches::kEnableColorCorrectRendering); |
| 89 if (base::mac::IsAtLeastOS10_12() && !color_correct_rendering_enabled) |
85 color_space = base::mac::GetSystemColorSpace(); | 90 color_space = base::mac::GetSystemColorSpace(); |
86 | 91 |
87 display.set_icc_profile(gfx::ICCProfile::FromCGColorSpace(color_space)); | 92 display.set_icc_profile(gfx::ICCProfile::FromCGColorSpace(color_space)); |
88 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); | 93 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); |
89 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); | 94 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); |
90 display.set_is_monochrome(CGDisplayUsesForceToGray()); | 95 display.set_is_monochrome(CGDisplayUsesForceToGray()); |
91 | 96 |
92 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will | 97 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will |
93 // handle the unexpected situations were the angle is not a multiple of 90. | 98 // handle the unexpected situations were the angle is not a multiple of 90. |
94 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); | 99 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return window; | 338 return window; |
334 } | 339 } |
335 | 340 |
336 #if !defined(USE_AURA) | 341 #if !defined(USE_AURA) |
337 Screen* CreateNativeScreen() { | 342 Screen* CreateNativeScreen() { |
338 return new ScreenMac; | 343 return new ScreenMac; |
339 } | 344 } |
340 #endif | 345 #endif |
341 | 346 |
342 } // namespace display | 347 } // namespace display |
OLD | NEW |