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/gfx/screen.h" | 5 #include "ui/gfx/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 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 display.set_work_area(work_area); | 68 display.set_work_area(work_area); |
69 } else { | 69 } else { |
70 display.set_bounds(ConvertCoordinateSystem(frame)); | 70 display.set_bounds(ConvertCoordinateSystem(frame)); |
71 display.set_work_area(ConvertCoordinateSystem(visible_frame)); | 71 display.set_work_area(ConvertCoordinateSystem(visible_frame)); |
72 } | 72 } |
73 CGFloat scale; | 73 CGFloat scale; |
74 if ([screen respondsToSelector:@selector(backingScaleFactor)]) | 74 if ([screen respondsToSelector:@selector(backingScaleFactor)]) |
75 scale = [screen backingScaleFactor]; | 75 scale = [screen backingScaleFactor]; |
76 else | 76 else |
77 scale = [screen userSpaceScaleFactor]; | 77 scale = [screen userSpaceScaleFactor]; |
| 78 |
| 79 if (gfx::Display::HasForceDeviceScaleFactor()) |
| 80 scale = gfx::Display::GetForcedDeviceScaleFactor(); |
| 81 |
78 display.set_device_scale_factor(scale); | 82 display.set_device_scale_factor(scale); |
79 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will | 83 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will |
80 // handle the unexpected situations were the angle is not a multiple of 90. | 84 // handle the unexpected situations were the angle is not a multiple of 90. |
81 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); | 85 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); |
82 return display; | 86 return display; |
83 } | 87 } |
84 | 88 |
85 class ScreenMac : public gfx::Screen { | 89 class ScreenMac : public gfx::Screen { |
86 public: | 90 public: |
87 ScreenMac() { | 91 ScreenMac() { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 273 |
270 namespace gfx { | 274 namespace gfx { |
271 | 275 |
272 #if !defined(USE_AURA) | 276 #if !defined(USE_AURA) |
273 Screen* CreateNativeScreen() { | 277 Screen* CreateNativeScreen() { |
274 return new ScreenMac; | 278 return new ScreenMac; |
275 } | 279 } |
276 #endif | 280 #endif |
277 | 281 |
278 } | 282 } |
OLD | NEW |