[email protected] | 2486dce | 2012-05-23 17:18:19 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
| 6 | #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
[email protected] | 2486dce | 2012-05-23 17:18:19 | [diff] [blame] | 7 | |
| 8 | #include "content/common/content_export.h" |
| 9 | |
| 10 | namespace gfx { |
| 11 | class Point; |
| 12 | class Rect; |
| 13 | class Size; |
| 14 | } // namespace gfx |
| 15 | |
| 16 | namespace content { |
| 17 | class RenderWidgetHostView; |
| 18 | |
Christopher Cameron | 3f04bdb | 2018-02-21 02:48:25 | [diff] [blame] | 19 | // This is the same as view->GetDeviceScaleFactor(), but will return a best |
| 20 | // guess when |view| is nullptr. |
Lucas Furukawa Gadani | 95fc361 | 2019-04-05 22:33:49 | [diff] [blame] | 21 | CONTENT_EXPORT float GetScaleFactorForView(RenderWidgetHostView* view); |
[email protected] | 2486dce | 2012-05-23 17:18:19 | [diff] [blame] | 22 | |
| 23 | // Utility functions that convert point/size/rect between DIP and pixel |
| 24 | // coordinate system. |
[email protected] | 4a5bb93 | 2013-05-27 12:52:49 | [diff] [blame] | 25 | CONTENT_EXPORT gfx::Point ConvertViewPointToDIP( |
Lucas Furukawa Gadani | 95fc361 | 2019-04-05 22:33:49 | [diff] [blame] | 26 | RenderWidgetHostView* view, |
| 27 | const gfx::Point& point_in_pixel); |
| 28 | CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel(RenderWidgetHostView* view, |
| 29 | const gfx::Size& size_in_dip); |
| 30 | CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel(RenderWidgetHostView* view, |
| 31 | const gfx::Rect& rect_in_dip); |
[email protected] | 4a5bb93 | 2013-05-27 12:52:49 | [diff] [blame] | 32 | |
[email protected] | 2486dce | 2012-05-23 17:18:19 | [diff] [blame] | 33 | } // namespace content |
| 34 | |
| 35 | #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |