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

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

Issue 1777653002: Prepare ui/ module for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More compile errors. Created 4 years, 9 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/events/cocoa/events_mac_unittest.mm ('k') | ui/snapshot/snapshot_mac.mm » ('j') | 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 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « ui/events/cocoa/events_mac_unittest.mm ('k') | ui/snapshot/snapshot_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698