blob: a7e1876ec797810254c6d56a944b649a39c29680 [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"
[email protected]1fab8c52012-10-05 21:08:339#include "ui/base/layout.h"
[email protected]2486dce2012-05-23 17:18:1910
11namespace gfx {
12class Point;
13class Rect;
14class Size;
15} // namespace gfx
16
17namespace content {
18class RenderWidgetHostView;
19
[email protected]1fab8c52012-10-05 21:08:3320// Returns scale factor of the display nearest to |view|.
21// Returns ui::SCALE_FACTOR_100P if the platform does not support DIP.
22CONTENT_EXPORT ui::ScaleFactor GetScaleFactorForView(
23 const RenderWidgetHostView* view);
[email protected]2486dce2012-05-23 17:18:1924
25// Utility functions that convert point/size/rect between DIP and pixel
26// coordinate system.
[email protected]4a5bb932013-05-27 12:52:4927CONTENT_EXPORT gfx::Point ConvertViewPointToDIP(
28 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel);
29CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel(
30 const RenderWidgetHostView* view, const gfx::Size& size_in_dip);
31CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel(
32 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip);
33
34CONTENT_EXPORT gfx::Size ConvertSizeToDIP(
35 float scale_factor, const gfx::Size& size_in_pixel);
36CONTENT_EXPORT gfx::Rect ConvertRectToDIP(
37 float scale_factor, const gfx::Rect& rect_in_pixel);
38CONTENT_EXPORT gfx::Rect ConvertRectToPixel(
39 float scale_factor, const gfx::Rect& rect_in_dip);
40
[email protected]2486dce2012-05-23 17:18:1941} // namespace content
42
43#endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_