Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
accessibility
gfx
mac
coordinate_conversion.mm
Go to the documentation of this file.
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 "
coordinate_conversion.h
"
6
7
#import <Cocoa/Cocoa.h>
8
9
#include "
gfx/geometry/point.h
"
10
#include "
gfx/geometry/rect.h
"
11
12
namespace
gfx
{
13
14
namespace
{
15
16
// The height of the primary display, which OSX defines as the monitor with the
17
// menubar. This is always at index 0.
18
CGFloat PrimaryDisplayHeight() {
19
return
NSMaxY([[[NSScreen screens] firstObject]
frame
]);
20
}
21
22
}
// namespace
23
24
NSRect
ScreenRectToNSRect
(
const
Rect
& rect) {
25
return
NSMakeRect(rect.x(), PrimaryDisplayHeight() - rect.y() - rect.height(), rect.width(),
26
rect.height());
27
}
28
29
Rect
ScreenRectFromNSRect
(
const
NSRect& rect) {
30
return
Rect
(rect.origin.x, PrimaryDisplayHeight() - rect.origin.y - rect.size.height,
31
rect.size.width, rect.size.height);
32
}
33
34
NSPoint
ScreenPointToNSPoint
(
const
Point
& point) {
35
return
NSMakePoint(point.
x
(), PrimaryDisplayHeight() - point.
y
());
36
}
37
38
Point
ScreenPointFromNSPoint
(
const
NSPoint& point) {
39
return
Point
(point.x, PrimaryDisplayHeight() - point.y);
40
}
41
42
}
// namespace gfx
gfx::Point
Definition
point.h:27
gfx::Point::y
constexpr int y() const
Definition
point.h:49
gfx::Point::x
constexpr int x() const
Definition
point.h:48
gfx::Rect
Definition
rect.h:36
coordinate_conversion.h
frame
double frame
Definition
examples.cpp:31
gfx
Definition
insets.cc:10
gfx::ScreenRectToNSRect
GFX_EXPORT NSRect ScreenRectToNSRect(const Rect &rect)
Definition
coordinate_conversion.mm:24
gfx::ScreenPointFromNSPoint
GFX_EXPORT Point ScreenPointFromNSPoint(const NSPoint &point)
Definition
coordinate_conversion.mm:38
gfx::ScreenRectFromNSRect
GFX_EXPORT Rect ScreenRectFromNSRect(const NSRect &point)
Definition
coordinate_conversion.mm:29
gfx::ScreenPointToNSPoint
GFX_EXPORT NSPoint ScreenPointToNSPoint(const Point &point)
Definition
coordinate_conversion.mm:34
point.h
rect.h
Generated on Fri Apr 26 2024 06:14:39 for Flutter Engine by
1.9.8