blob: d9e2fc1b442f99a83aecf5ff8b2bcc9430656b43 [file] [log] [blame]
[email protected]2486dce2012-05-23 17:18:191// 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]2486dce2012-05-23 17:18:197
8#include "content/common/content_export.h"
9
10namespace gfx {
11class Point;
12class Rect;
13class Size;
14} // namespace gfx
15
16namespace content {
17class RenderWidgetHostView;
18
Christopher Cameron3f04bdb2018-02-21 02:48:2519// This is the same as view->GetDeviceScaleFactor(), but will return a best
20// guess when |view| is nullptr.
Lucas Furukawa Gadani95fc3612019-04-05 22:33:4921CONTENT_EXPORT float GetScaleFactorForView(RenderWidgetHostView* view);
[email protected]2486dce2012-05-23 17:18:1922
23// Utility functions that convert point/size/rect between DIP and pixel
24// coordinate system.
[email protected]4a5bb932013-05-27 12:52:4925CONTENT_EXPORT gfx::Point ConvertViewPointToDIP(
Lucas Furukawa Gadani95fc3612019-04-05 22:33:4926 RenderWidgetHostView* view,
27 const gfx::Point& point_in_pixel);
28CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel(RenderWidgetHostView* view,
29 const gfx::Size& size_in_dip);
30CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel(RenderWidgetHostView* view,
31 const gfx::Rect& rect_in_dip);
[email protected]4a5bb932013-05-27 12:52:4932
[email protected]2486dce2012-05-23 17:18:1933} // namespace content
34
35#endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_