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 #include "ui/base/layout.h" | 5 #include "ui/base/layout.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 return gfx::GetDPIScale(); | 85 return gfx::GetDPIScale(); |
86 #else | 86 #else |
87 return GetScaleForScaleFactor(scale_factor); | 87 return GetScaleForScaleFactor(scale_factor); |
88 #endif | 88 #endif |
89 } | 89 } |
90 | 90 |
91 float GetScaleForScaleFactor(ScaleFactor scale_factor) { | 91 float GetScaleForScaleFactor(ScaleFactor scale_factor) { |
92 return kScaleFactorScales[scale_factor]; | 92 return kScaleFactorScales[scale_factor]; |
93 } | 93 } |
94 | 94 |
95 bool IsSupportedScale(float scale) { | |
96 const std::vector<float>& supported_scales = | |
97 gfx::ImageSkia::GetSupportedScales(); | |
sky
2015/03/25 14:49:10
Why are you using ImageSkia and not g_supported_sc
ananta
2015/03/25 16:56:05
Done.
| |
98 return std::find(supported_scales.begin(), supported_scales.end(), scale) | |
99 != supported_scales.end(); | |
100 } | |
101 | |
95 namespace test { | 102 namespace test { |
96 | 103 |
97 ScopedSetSupportedScaleFactors::ScopedSetSupportedScaleFactors( | 104 ScopedSetSupportedScaleFactors::ScopedSetSupportedScaleFactors( |
98 const std::vector<ui::ScaleFactor>& new_scale_factors) { | 105 const std::vector<ui::ScaleFactor>& new_scale_factors) { |
99 if (g_supported_scale_factors) { | 106 if (g_supported_scale_factors) { |
100 original_scale_factors_ = | 107 original_scale_factors_ = |
101 new std::vector<ScaleFactor>(*g_supported_scale_factors); | 108 new std::vector<ScaleFactor>(*g_supported_scale_factors); |
102 } else { | 109 } else { |
103 original_scale_factors_ = NULL; | 110 original_scale_factors_ = NULL; |
104 } | 111 } |
(...skipping 14 matching lines...) Expand all Loading... | |
119 | 126 |
120 #if !defined(OS_MACOSX) | 127 #if !defined(OS_MACOSX) |
121 float GetScaleFactorForNativeView(gfx::NativeView view) { | 128 float GetScaleFactorForNativeView(gfx::NativeView view) { |
122 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 129 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
123 gfx::Display display = screen->GetDisplayNearestWindow(view); | 130 gfx::Display display = screen->GetDisplayNearestWindow(view); |
124 return display.device_scale_factor(); | 131 return display.device_scale_factor(); |
125 } | 132 } |
126 #endif // !defined(OS_MACOSX) | 133 #endif // !defined(OS_MACOSX) |
127 | 134 |
128 } // namespace ui | 135 } // namespace ui |
OLD | NEW |