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

Side by Side Diff: ui/gfx/screen_mac.mm

Issue 1111543003: Fix --force-device-scale-factor on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | 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/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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698