Update V8 to version 4.6.55.
[chromium-blink-merge.git] / ui / compositor / dip_util.h
blobb4c02575d9a2183ea06c10e5de1cc913ffe6d144
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 UI_COMPOSITOR_DIP_UTIL_H_
6 #define UI_COMPOSITOR_DIP_UTIL_H_
8 #include "base/basictypes.h"
9 #include "ui/compositor/compositor_export.h"
10 #include "ui/gfx/geometry/point_f.h"
12 namespace gfx {
13 class Point;
14 class Size;
15 class Rect;
16 } // namespace gfx
18 namespace ui {
19 class Layer;
21 COMPOSITOR_EXPORT float GetDeviceScaleFactor(const Layer* layer);
23 // Utility functions that convert point/size/rect between
24 // DIP and pixel coordinates system.
25 COMPOSITOR_EXPORT gfx::Point ConvertPointToDIP(
26 const Layer* layer,
27 const gfx::Point& point_in_pixel);
28 COMPOSITOR_EXPORT gfx::PointF ConvertPointToDIP(
29 const Layer* layer,
30 const gfx::PointF& point_in_pixel);
31 COMPOSITOR_EXPORT gfx::Size ConvertSizeToDIP(
32 const Layer* layer,
33 const gfx::Size& size_in_pixel);
34 COMPOSITOR_EXPORT gfx::Rect ConvertRectToDIP(
35 const Layer* layer,
36 const gfx::Rect& rect_in_pixel);
37 COMPOSITOR_EXPORT gfx::Point ConvertPointToPixel(
38 const Layer* layer,
39 const gfx::Point& point_in_dip);
40 COMPOSITOR_EXPORT gfx::Size ConvertSizeToPixel(
41 const Layer* layer,
42 const gfx::Size& size_in_dip);
43 COMPOSITOR_EXPORT gfx::Rect ConvertRectToPixel(
44 const Layer* layer,
45 const gfx::Rect& rect_in_dip);
47 // Snaps the |layer_to_snap| to the physical pixel boundary.
48 // |snapped_layer| is a reference layer that should also be
49 // snapped at the pysical pixel boundary.
50 COMPOSITOR_EXPORT void SnapLayerToPhysicalPixelBoundary(
51 ui::Layer* snapped_layer,
52 ui::Layer* layer_to_snap);
54 } // namespace ui
56 #endif // UI_COMPOSITOR_DIP_UTIL_H_