Allow interface scale of 50%.

This commit is contained in:
John Preston 2022-09-01 11:23:16 +04:00
parent a5766cb1f6
commit 746eb80300
2 changed files with 8 additions and 5 deletions

View file

@ -21,7 +21,7 @@ int DevicePixelRatio() {
}
void SetDevicePixelRatio(int ratio) {
DevicePixelRatioValue = ratio;
DevicePixelRatioValue = std::clamp(ratio, 1, kScaleMax / kScaleMin);
}
int Scale() {

View file

@ -16,7 +16,7 @@
namespace style {
inline constexpr auto kScaleAuto = 0;
inline constexpr auto kScaleMin = 75;
inline constexpr auto kScaleMin = 50;
inline constexpr auto kScaleDefault = 100;
inline constexpr auto kScaleMax = 300;
@ -34,9 +34,12 @@ void SetScale(int scale);
template <typename T>
[[nodiscard]] inline T ConvertScale(T value, int scale) {
return (value < 0.)
? (-ConvertScale(-value, scale))
: T(base::SafeRound((double(value) * scale / 100.) - 0.01));
if (value < 0.) {
return -ConvertScale(-value, scale);
}
const auto result = T(base::SafeRound(
(double(value) * scale / 100.) - 0.01));
return (!std::is_integral_v<T> || !value || result) ? result : 1;
}
template <typename T>