Allow larger scales on high-dpi screens.

This commit is contained in:
John Preston 2023-03-15 17:17:46 +04:00
parent ba01ba4c33
commit 7264d82e8d
4 changed files with 7 additions and 8 deletions

View File

@ -246,11 +246,10 @@ void Sandbox::setupScreenScale() {
// 110% for Retina screens by default. // 110% for Retina screens by default.
cSetScreenScale((useRatio == 2) ? 110 : style::kScaleDefault); cSetScreenScale((useRatio == 2) ? 110 : style::kScaleDefault);
} else { } else {
const auto clamped = std::clamp( cSetScreenScale(std::clamp(
screenScale * useRatio, screenScale,
style::kScaleMin * useRatio, style::kScaleMin,
style::kScaleMax); style::MaxScaleForRatio(useRatio)));
cSetScreenScale(int(base::SafeRound(clamped * 1. / useRatio)));
} }
LOG(("DevicePixelRatio: %1").arg(useRatio)); LOG(("DevicePixelRatio: %1").arg(useRatio));
LOG(("ScreenScale: %1").arg(cScreenScale())); LOG(("ScreenScale: %1").arg(cScreenScale()));

View File

@ -447,7 +447,7 @@ void SetupInterfaceScale(
const auto ratio = style::DevicePixelRatio(); const auto ratio = style::DevicePixelRatio();
const auto scaleMin = style::kScaleMin; const auto scaleMin = style::kScaleMin;
const auto scaleMax = style::kScaleMax / ratio; const auto scaleMax = style::MaxScaleForRatio(ratio);
const auto scaleConfig = cConfigScale(); const auto scaleConfig = cConfigScale();
const auto step = 5; const auto step = 5;
Assert(!((scaleMax - scaleMin) % step)); Assert(!((scaleMax - scaleMin) % step));

View File

@ -298,7 +298,7 @@ void Preview::init() {
initAsWindow(); initAsWindow();
updateToScale(style::kScaleMin); updateToScale(style::kScaleMin);
_minOuterSize = _outer.size(); _minOuterSize = _outer.size();
updateToScale(style::kScaleMax / _ratio); updateToScale(style::MaxScaleForRatio(_ratio));
_maxOuterSize = _outer.size(); _maxOuterSize = _outer.size();
} }
} }

@ -1 +1 @@
Subproject commit dec1cd8cea24e396c37c327929c0135d46541626 Subproject commit bcb56492c4cab204b8b27d762586e4bdbcc6c074