OLD | NEW |
(Empty) | |
| 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 #pragma once |
| 8 |
| 9 #include "ui/compositor/compositor_export.h" |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 namespace gfx { |
| 13 class Point; |
| 14 class Size; |
| 15 class Rect; |
| 16 } // namespace gfx |
| 17 |
| 18 namespace ui { |
| 19 namespace test { |
| 20 |
| 21 // A scoped object allows you to temporarily enable DIP |
| 22 // in the unit tests. |
| 23 class COMPOSITOR_EXPORT ScopedDIPEnablerForTest { |
| 24 public: |
| 25 ScopedDIPEnablerForTest(); |
| 26 ~ScopedDIPEnablerForTest(); |
| 27 |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(ScopedDIPEnablerForTest); |
| 30 }; |
| 31 |
| 32 } // namespace test |
| 33 |
| 34 class Layer; |
| 35 |
| 36 // True if DIP is enabled. |
| 37 COMPOSITOR_EXPORT bool IsDIPEnabled(); |
| 38 |
| 39 COMPOSITOR_EXPORT float GetDeviceScaleFactor(const Layer* layer); |
| 40 |
| 41 // Utility functions that convert point/size/rect between |
| 42 // DIP and pixel coordinates system. |
| 43 COMPOSITOR_EXPORT gfx::Point ConvertPointToDIP( |
| 44 const Layer* layer, |
| 45 const gfx::Point& point_in_pixel); |
| 46 COMPOSITOR_EXPORT gfx::Size ConvertSizeToDIP( |
| 47 const Layer* layer, |
| 48 const gfx::Size& size_in_pixel); |
| 49 COMPOSITOR_EXPORT gfx::Rect ConvertRectToDIP( |
| 50 const Layer* layer, |
| 51 const gfx::Rect& rect_in_pixel); |
| 52 COMPOSITOR_EXPORT gfx::Point ConvertPointToPixel( |
| 53 const Layer* layer, |
| 54 const gfx::Point& point_in_dip); |
| 55 COMPOSITOR_EXPORT gfx::Size ConvertSizeToPixel( |
| 56 const Layer* layer, |
| 57 const gfx::Size& size_in_dip); |
| 58 COMPOSITOR_EXPORT gfx::Rect ConvertRectToPixel( |
| 59 const Layer* layer, |
| 60 const gfx::Rect& rect_in_dip); |
| 61 |
| 62 } // namespace ui |
| 63 |
| 64 #endif // UI_COMPOSITOR_DIP_UTIL_H_ |
OLD | NEW |