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

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

Issue 2336113003: Revert of cc: Plumb the monitor color profile to renderer for rasterization (Closed)
Patch Set: 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
26 namespace display { 22 namespace display {
27 namespace { 23 namespace {
28 24
29 // The delay to handle the display configuration changes. 25 // The delay to handle the display configuration changes.
30 // See comments in ScreenMac::HandleDisplayReconfiguration. 26 // See comments in ScreenMac::HandleDisplayReconfiguration.
31 const int64_t kConfigureDelayMs = 500; 27 const int64_t kConfigureDelayMs = 500;
32 28
33 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) { 29 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
34 // Default to the monitor with the current keyboard focus, in case 30 // Default to the monitor with the current keyboard focus, in case
35 // |match_rect| is not on any screen at all. 31 // |match_rect| is not on any screen at all.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } else { 64 } else {
69 display.set_bounds(gfx::ScreenRectFromNSRect(frame)); 65 display.set_bounds(gfx::ScreenRectFromNSRect(frame));
70 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame)); 66 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame));
71 } 67 }
72 CGFloat scale = [screen backingScaleFactor]; 68 CGFloat scale = [screen backingScaleFactor];
73 69
74 if (Display::HasForceDeviceScaleFactor()) 70 if (Display::HasForceDeviceScaleFactor())
75 scale = Display::GetForcedDeviceScaleFactor(); 71 scale = Display::GetForcedDeviceScaleFactor();
76 72
77 display.set_device_scale_factor(scale); 73 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
85 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will 74 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will
86 // handle the unexpected situations were the angle is not a multiple of 90. 75 // handle the unexpected situations were the angle is not a multiple of 90.
87 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); 76 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id)));
88 return display; 77 return display;
89 } 78 }
90 79
91 // Returns the minimum Manhattan distance from |point| to corners of |screen| 80 // Returns the minimum Manhattan distance from |point| to corners of |screen|
92 // frame. 81 // frame.
93 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) { 82 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) {
94 NSRect frame = [screen frame]; 83 NSRect frame = [screen frame];
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 280
292 } // namespace 281 } // namespace
293 282
294 #if !defined(USE_AURA) 283 #if !defined(USE_AURA)
295 Screen* CreateNativeScreen() { 284 Screen* CreateNativeScreen() {
296 return new ScreenMac; 285 return new ScreenMac;
297 } 286 }
298 #endif 287 #endif
299 288
300 } // namespace display 289 } // 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