| 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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Convert work area's coordinate systems. | 65 // Convert work area's coordinate systems. |
| 66 if ([screen isEqual:primary]) { | 66 if ([screen isEqual:primary]) { |
| 67 gfx::Rect work_area = gfx::Rect(NSRectToCGRect(visible_frame)); | 67 gfx::Rect work_area = gfx::Rect(NSRectToCGRect(visible_frame)); |
| 68 work_area.set_y(frame.size.height - visible_frame.origin.y - | 68 work_area.set_y(frame.size.height - visible_frame.origin.y - |
| 69 visible_frame.size.height); | 69 visible_frame.size.height); |
| 70 display.set_work_area(work_area); | 70 display.set_work_area(work_area); |
| 71 } else { | 71 } else { |
| 72 display.set_bounds(ConvertCoordinateSystem(frame)); | 72 display.set_bounds(ConvertCoordinateSystem(frame)); |
| 73 display.set_work_area(ConvertCoordinateSystem(visible_frame)); | 73 display.set_work_area(ConvertCoordinateSystem(visible_frame)); |
| 74 } | 74 } |
| 75 CGFloat scale; | 75 CGFloat scale = [screen backingScaleFactor]; |
| 76 if ([screen respondsToSelector:@selector(backingScaleFactor)]) | |
| 77 scale = [screen backingScaleFactor]; | |
| 78 else | |
| 79 scale = [screen userSpaceScaleFactor]; | |
| 80 | 76 |
| 81 if (gfx::Display::HasForceDeviceScaleFactor()) | 77 if (gfx::Display::HasForceDeviceScaleFactor()) |
| 82 scale = gfx::Display::GetForcedDeviceScaleFactor(); | 78 scale = gfx::Display::GetForcedDeviceScaleFactor(); |
| 83 | 79 |
| 84 display.set_device_scale_factor(scale); | 80 display.set_device_scale_factor(scale); |
| 85 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will | 81 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will |
| 86 // handle the unexpected situations were the angle is not a multiple of 90. | 82 // handle the unexpected situations were the angle is not a multiple of 90. |
| 87 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); | 83 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); |
| 88 return display; | 84 return display; |
| 89 } | 85 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 271 |
| 276 namespace gfx { | 272 namespace gfx { |
| 277 | 273 |
| 278 #if !defined(USE_AURA) | 274 #if !defined(USE_AURA) |
| 279 Screen* CreateNativeScreen() { | 275 Screen* CreateNativeScreen() { |
| 280 return new ScreenMac; | 276 return new ScreenMac; |
| 281 } | 277 } |
| 282 #endif | 278 #endif |
| 283 | 279 |
| 284 } | 280 } |
| OLD | NEW |