feat(render): logical style metrics with a UI scale, so chrome has a consistent physical size

This commit is contained in:
Martino Ferrari committed 2026-09-28 12:17:53 +02:00
1 parent 1f03631e98
commit 7500fc90d2
21 files changed
+708 -82

No files matched your search

+6
View File
@@ -249,6 +249,12 @@ void Host::refresh_sizes() noexcept {
fb_height_ = fh > 0 ? static_cast<u32>(fh) : 0u;
if (ww > 0 && fw > 0) fb_scale_x_ = static_cast<f32>(fw) / static_cast<f32>(ww);
if (wh > 0 && fh > 0) fb_scale_y_ = static_cast<f32>(fh) / static_cast<f32>(wh);
// The renderer draws its logical style metrics at this same ratio, so the chrome
// is the same physical size at any scale: one value states the display, and a
// 12 px label is 24 device px on the 2x panel both these sizes describe. Read here
// rather than in the frame loop because this is the one place the two sizes are,
// and re-read whenever the window moves to a display with another scale.
if (renderer_) renderer_->style().ui_scale = fb_scale_x_;
}
// ------------------------------------------------------------------ events