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

Side by Side Diff: ui/gfx/mac/coordinate_conversion.mm

Issue 353643002: MacViews: Implement Set/Get*Bounds for NativeWidgetMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: import Foundation.h for NSRect Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/mac/coordinate_conversion.h ('k') | ui/views/widget/native_widget_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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/gfx/mac/coordinate_conversion.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "ui/gfx/geometry/rect.h"
10
11 namespace gfx {
12
13 namespace {
14
15 // The height of the primary display, which OSX defines as the monitor with the
16 // menubar. This is always at index 0.
17 CGFloat PrimaryDisplayHeight() {
18 return NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]);
19 }
20
21 } // namespace
22
23 NSRect ScreenRectToNSRect(const gfx::Rect& rect) {
24 return NSMakeRect(rect.x(),
25 PrimaryDisplayHeight() - rect.y() - rect.height(),
26 rect.width(),
27 rect.height());
28 }
29
30 gfx::Rect ScreenRectFromNSRect(const NSRect& rect) {
31 return gfx::Rect(rect.origin.x,
32 PrimaryDisplayHeight() - rect.origin.y - rect.size.height,
33 rect.size.width,
34 rect.size.height);
35 }
36
37 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/mac/coordinate_conversion.h ('k') | ui/views/widget/native_widget_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698