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"
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(
27 const gfx::Point
& point_in_pixel
);
28 COMPOSITOR_EXPORT
gfx::PointF
ConvertPointToDIP(
30 const gfx::PointF
& point_in_pixel
);
31 COMPOSITOR_EXPORT
gfx::Size
ConvertSizeToDIP(
33 const gfx::Size
& size_in_pixel
);
34 COMPOSITOR_EXPORT
gfx::Rect
ConvertRectToDIP(
36 const gfx::Rect
& rect_in_pixel
);
37 COMPOSITOR_EXPORT
gfx::Point
ConvertPointToPixel(
39 const gfx::Point
& point_in_dip
);
40 COMPOSITOR_EXPORT
gfx::Size
ConvertSizeToPixel(
42 const gfx::Size
& size_in_dip
);
43 COMPOSITOR_EXPORT
gfx::Rect
ConvertRectToPixel(
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
);
56 #endif // UI_COMPOSITOR_DIP_UTIL_H_