Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef UI_GFX_MAC_COORDINATE_CONVERSION_H_ | 5 #ifndef UI_GFX_MAC_COORDINATE_CONVERSION_H_ |
| 6 #define UI_GFX_MAC_COORDINATE_CONVERSION_H_ | 6 #define UI_GFX_MAC_COORDINATE_CONVERSION_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 | 13 |
| 14 class Point; | 14 class Point; |
| 15 class Rect; | 15 class Rect; |
| 16 class Size; | |
| 16 | 17 |
| 17 // Convert a gfx::Rect specified with the origin at the top left of the primary | 18 // Convert a gfx::Rect specified with the origin at the top left of the primary |
| 18 // display into AppKit secreen coordinates (origin at the bottom left). | 19 // display into AppKit screen coordinates (origin at the bottom left). |
| 19 GFX_EXPORT NSRect ScreenRectToNSRect(const Rect& rect); | 20 GFX_EXPORT NSRect ScreenRectToNSRect(const Rect& rect); |
| 20 | 21 |
| 21 // Convert an AppKit NSRect with origin in the bottom left of the primary | 22 // Convert an AppKit NSRect with origin in the bottom left of the primary |
| 22 // display into a gfx::Rect with origin at the top left of the primary display. | 23 // display into a gfx::Rect with origin at the top left of the primary display. |
| 23 GFX_EXPORT Rect ScreenRectFromNSRect(const NSRect& point); | 24 GFX_EXPORT Rect ScreenRectFromNSRect(const NSRect& point); |
| 24 | 25 |
| 26 // Convert a gfx::Size specified in pixels display into AppKit screen sizes. | |
| 27 GFX_EXPORT NSSize ScreenSizeToNSSize(const Size& size); | |
|
tapted
2016/06/06 04:09:51
Something like `NSSize ns_size = size.ToCGSize()`
Patti Lor
2016/06/10 01:36:10
Done.
| |
| 28 | |
| 29 // Convert an AppKit NSSize into a gfx::Size. | |
| 30 GFX_EXPORT Size ScreenSizeFromNSSize(const NSSize& size); | |
| 31 | |
| 25 // Convert a gfx::Point specified with the origin at the top left of the primary | 32 // Convert a gfx::Point specified with the origin at the top left of the primary |
| 26 // display into AppKit screen coordinates (origin at the bottom left). | 33 // display into AppKit screen coordinates (origin at the bottom left). |
| 27 GFX_EXPORT NSPoint ScreenPointToNSPoint(const Point& point); | 34 GFX_EXPORT NSPoint ScreenPointToNSPoint(const Point& point); |
| 28 | 35 |
| 29 // Convert an AppKit NSPoint with origin in the bottom left of the primary | 36 // Convert an AppKit NSPoint with origin in the bottom left of the primary |
| 30 // display into a gfx::Point with origin at the top left of the primary display. | 37 // display into a gfx::Point with origin at the top left of the primary display. |
| 31 GFX_EXPORT Point ScreenPointFromNSPoint(const NSPoint& point); | 38 GFX_EXPORT Point ScreenPointFromNSPoint(const NSPoint& point); |
| 32 | 39 |
| 33 } // namespace gfx | 40 } // namespace gfx |
| 34 | 41 |
| 35 #endif // UI_GFX_MAC_COORDINATE_CONVERSION_H_ | 42 #endif // UI_GFX_MAC_COORDINATE_CONVERSION_H_ |
| OLD | NEW |