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

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

Issue 2325773003: cc: Plumb the monitor color profile to renderer for rasterization (Closed)
Patch Set: Unrevert Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/display/display.cc ('k') | no next file » | 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/logging.h" 14 #include "base/logging.h"
15 #include "base/mac/sdk_forward_declarations.h" 15 #include "base/mac/sdk_forward_declarations.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "ui/display/display.h" 18 #include "ui/display/display.h"
19 #include "ui/display/display_change_notifier.h" 19 #include "ui/display/display_change_notifier.h"
20 #include "ui/gfx/mac/coordinate_conversion.h" 20 #include "ui/gfx/mac/coordinate_conversion.h"
21 21
22 extern "C" {
23 Boolean CGDisplayUsesForceToGray(void);
24 }
25
22 namespace display { 26 namespace display {
23 namespace { 27 namespace {
24 28
25 // The delay to handle the display configuration changes. 29 // The delay to handle the display configuration changes.
26 // See comments in ScreenMac::HandleDisplayReconfiguration. 30 // See comments in ScreenMac::HandleDisplayReconfiguration.
27 const int64_t kConfigureDelayMs = 500; 31 const int64_t kConfigureDelayMs = 500;
28 32
29 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) { 33 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
30 // Default to the monitor with the current keyboard focus, in case 34 // Default to the monitor with the current keyboard focus, in case
31 // |match_rect| is not on any screen at all. 35 // |match_rect| is not on any screen at all.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } else { 68 } else {
65 display.set_bounds(gfx::ScreenRectFromNSRect(frame)); 69 display.set_bounds(gfx::ScreenRectFromNSRect(frame));
66 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame)); 70 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame));
67 } 71 }
68 CGFloat scale = [screen backingScaleFactor]; 72 CGFloat scale = [screen backingScaleFactor];
69 73
70 if (Display::HasForceDeviceScaleFactor()) 74 if (Display::HasForceDeviceScaleFactor())
71 scale = Display::GetForcedDeviceScaleFactor(); 75 scale = Display::GetForcedDeviceScaleFactor();
72 76
73 display.set_device_scale_factor(scale); 77 display.set_device_scale_factor(scale);
78
79 display.set_icc_profile(
80 gfx::ICCProfile::FromCGColorSpace([[screen colorSpace] CGColorSpace]));
81 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth]));
82 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth]));
83 display.set_is_monochrome(CGDisplayUsesForceToGray());
84
74 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will 85 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will
75 // handle the unexpected situations were the angle is not a multiple of 90. 86 // handle the unexpected situations were the angle is not a multiple of 90.
76 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); 87 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id)));
77 return display; 88 return display;
78 } 89 }
79 90
80 // Returns the minimum Manhattan distance from |point| to corners of |screen| 91 // Returns the minimum Manhattan distance from |point| to corners of |screen|
81 // frame. 92 // frame.
82 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) { 93 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) {
83 NSRect frame = [screen frame]; 94 NSRect frame = [screen frame];
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 291
281 } // namespace 292 } // namespace
282 293
283 #if !defined(USE_AURA) 294 #if !defined(USE_AURA)
284 Screen* CreateNativeScreen() { 295 Screen* CreateNativeScreen() {
285 return new ScreenMac; 296 return new ScreenMac;
286 } 297 }
287 #endif 298 #endif
288 299
289 } // namespace display 300 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698