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 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } else { | 64 } else { |
65 display.set_bounds(gfx::ScreenRectFromNSRect(frame)); | 65 display.set_bounds(gfx::ScreenRectFromNSRect(frame)); |
66 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame)); | 66 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame)); |
67 } | 67 } |
68 CGFloat scale = [screen backingScaleFactor]; | 68 CGFloat scale = [screen backingScaleFactor]; |
69 | 69 |
70 if (Display::HasForceDeviceScaleFactor()) | 70 if (Display::HasForceDeviceScaleFactor()) |
71 scale = Display::GetForcedDeviceScaleFactor(); | 71 scale = Display::GetForcedDeviceScaleFactor(); |
72 | 72 |
73 display.set_device_scale_factor(scale); | 73 display.set_device_scale_factor(scale); |
| 74 |
| 75 display.set_icc_profile( |
| 76 gfx::ICCProfile::FromCGColorSpace([[screen colorSpace] CGColorSpace])); |
| 77 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); |
| 78 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); |
| 79 |
74 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will | 80 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will |
75 // handle the unexpected situations were the angle is not a multiple of 90. | 81 // handle the unexpected situations were the angle is not a multiple of 90. |
76 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); | 82 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); |
77 return display; | 83 return display; |
78 } | 84 } |
79 | 85 |
80 // Returns the minimum Manhattan distance from |point| to corners of |screen| | 86 // Returns the minimum Manhattan distance from |point| to corners of |screen| |
81 // frame. | 87 // frame. |
82 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) { | 88 CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) { |
83 NSRect frame = [screen frame]; | 89 NSRect frame = [screen frame]; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 286 |
281 } // namespace | 287 } // namespace |
282 | 288 |
283 #if !defined(USE_AURA) | 289 #if !defined(USE_AURA) |
284 Screen* CreateNativeScreen() { | 290 Screen* CreateNativeScreen() { |
285 return new ScreenMac; | 291 return new ScreenMac; |
286 } | 292 } |
287 #endif | 293 #endif |
288 | 294 |
289 } // namespace display | 295 } // namespace display |
OLD | NEW |