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

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

Issue 303543004: MacViews: views_examples_with_content_exe working! Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add files Created 6 years, 6 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/point_utils.h ('k') | ui/gl/gl_context_cgl.cc » ('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/point_utils.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/rect.h"
11
12 namespace gfx {
13
14 namespace {
15
16 CGFloat PrimaryDisplayHeight() {
17 return NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]);
18 }
19
20 } // namespace
21
22 NSPoint ScreenPointToNSPoint(const gfx::Point& point) {
23 return NSMakePoint(point.x(), PrimaryDisplayHeight() - point.y());
24 }
25
26 gfx::Point ScreenPointFromNSPoint(const NSPoint& point) {
27 return gfx::Point(point.x, PrimaryDisplayHeight() - point.y);
28 }
29
30 NSRect ScreenRectToNSRect(const gfx::Rect& rect) {
31 return NSMakeRect(rect.x(),
32 PrimaryDisplayHeight() - rect.y() - rect.height(),
33 rect.width(),
34 rect.height());
35 }
36
37 gfx::Rect ScreenRectFromNSRect(const NSRect& rect) {
38 return gfx::Rect(rect.origin.x,
39 PrimaryDisplayHeight() - rect.origin.y - rect.size.height,
40 rect.size.width,
41 rect.size.height);
42 }
43
44 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/mac/point_utils.h ('k') | ui/gl/gl_context_cgl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698