Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / renderer_host / dip_util.h
blob27e7dd19e9e4f0aa10ba402f2c2ddca87613b3b9
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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_
8 #include "content/common/content_export.h"
10 namespace gfx {
11 class Point;
12 class Rect;
13 class Size;
14 } // namespace gfx
16 namespace content {
17 class RenderWidgetHostView;
19 // Returns scale factor of the display nearest to |view|.
20 // Returns 1.0f if the platform does not support DIP.
21 CONTENT_EXPORT float GetScaleFactorForView(const RenderWidgetHostView* view);
23 // Utility functions that convert point/size/rect between DIP and pixel
24 // coordinate system.
25 CONTENT_EXPORT gfx::Point ConvertViewPointToDIP(
26 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel);
27 CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel(
28 const RenderWidgetHostView* view, const gfx::Size& size_in_dip);
29 CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel(
30 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip);
32 CONTENT_EXPORT gfx::Size ConvertSizeToDIP(
33 float scale_factor, const gfx::Size& size_in_pixel);
34 CONTENT_EXPORT gfx::Rect ConvertRectToDIP(
35 float scale_factor, const gfx::Rect& rect_in_pixel);
36 CONTENT_EXPORT gfx::Size ConvertSizeToPixel(
37 float scale_factor, const gfx::Size& size_in_pixel);
38 CONTENT_EXPORT gfx::Rect ConvertRectToPixel(
39 float scale_factor, const gfx::Rect& rect_in_dip);
41 } // namespace content
43 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_