dip_util.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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. 4 5#ifndef UI_COMPOSITOR_DIP_UTIL_H_ 6#define UI_COMPOSITOR_DIP_UTIL_H_ 7 8#include "ui/compositor/compositor_export.h" 9#include "base/basictypes.h" 10 11namespace gfx { 12class Point; 13class Size; 14class Rect; 15} // namespace gfx 16 17namespace ui { 18class Layer; 19 20COMPOSITOR_EXPORT float GetDeviceScaleFactor(const Layer* layer); 21 22// Utility functions that convert point/size/rect between 23// DIP and pixel coordinates system. 24COMPOSITOR_EXPORT gfx::Point ConvertPointToDIP( 25 const Layer* layer, 26 const gfx::Point& point_in_pixel); 27COMPOSITOR_EXPORT gfx::Size ConvertSizeToDIP( 28 const Layer* layer, 29 const gfx::Size& size_in_pixel); 30COMPOSITOR_EXPORT gfx::Rect ConvertRectToDIP( 31 const Layer* layer, 32 const gfx::Rect& rect_in_pixel); 33COMPOSITOR_EXPORT gfx::Point ConvertPointToPixel( 34 const Layer* layer, 35 const gfx::Point& point_in_dip); 36COMPOSITOR_EXPORT gfx::Size ConvertSizeToPixel( 37 const Layer* layer, 38 const gfx::Size& size_in_dip); 39COMPOSITOR_EXPORT gfx::Rect ConvertRectToPixel( 40 const Layer* layer, 41 const gfx::Rect& rect_in_dip); 42 43} // namespace ui 44 45#endif // UI_COMPOSITOR_DIP_UTIL_H_ 46