OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_BASE_LAYOUT_H_ | 5 #ifndef UI_BASE_LAYOUT_H_ |
6 #define UI_BASE_LAYOUT_H_ | 6 #define UI_BASE_LAYOUT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Use ScopedSetSupportedScaleFactors for unit tests as not to affect the | 51 // Use ScopedSetSupportedScaleFactors for unit tests as not to affect the |
52 // state of other tests. | 52 // state of other tests. |
53 UI_BASE_EXPORT void SetSupportedScaleFactors( | 53 UI_BASE_EXPORT void SetSupportedScaleFactors( |
54 const std::vector<ScaleFactor>& scale_factors); | 54 const std::vector<ScaleFactor>& scale_factors); |
55 | 55 |
56 // Returns a vector with the scale factors which are supported by this | 56 // Returns a vector with the scale factors which are supported by this |
57 // platform, in ascending order. | 57 // platform, in ascending order. |
58 UI_BASE_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); | 58 UI_BASE_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); |
59 | 59 |
60 // Returns the float scale value for |scale_factor|. | 60 // Returns the float scale value for |scale_factor|. |
| 61 UI_BASE_EXPORT float GetImageScaleForScaleFactor(ScaleFactor scale_factor); |
| 62 |
| 63 // Returns the actual image scale to be used for the scale factor passed in. |
| 64 // For all platforms except Windows high dpi, this returns the value returned |
| 65 // by the GetImageScaleForScaleFactor function above. |
| 66 // For Windows with high dpi enabled it returns the dpi scale for the |
| 67 // display. |
61 UI_BASE_EXPORT float GetImageScale(ScaleFactor scale_factor); | 68 UI_BASE_EXPORT float GetImageScale(ScaleFactor scale_factor); |
62 | 69 |
63 // Returns the supported ScaleFactor which most closely matches |scale|. | 70 // Returns the supported ScaleFactor which most closely matches |scale|. |
64 // Converting from float to ScaleFactor is inefficient and should be done as | 71 // Converting from float to ScaleFactor is inefficient and should be done as |
65 // little as possible. | 72 // little as possible. |
66 // TODO(oshima): Make ScaleFactor a class and remove this. | 73 // TODO(oshima): Make ScaleFactor a class and remove this. |
67 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); | 74 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); |
68 | 75 |
69 // Returns the ScaleFactor used by |view|. | 76 // Returns the ScaleFactor used by |view|. |
70 UI_BASE_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view); | 77 UI_BASE_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view); |
(...skipping 19 matching lines...) Expand all Loading... |
90 std::vector<ui::ScaleFactor>* original_scale_factors_; | 97 std::vector<ui::ScaleFactor>* original_scale_factors_; |
91 | 98 |
92 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); | 99 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); |
93 }; | 100 }; |
94 | 101 |
95 } // namespace test | 102 } // namespace test |
96 | 103 |
97 } // namespace ui | 104 } // namespace ui |
98 | 105 |
99 #endif // UI_BASE_LAYOUT_H_ | 106 #endif // UI_BASE_LAYOUT_H_ |
OLD | NEW |