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

+5
View File
@@ -119,6 +119,11 @@ void PlotWidget::draw(const char* id, Plot& plot, Vec2 size, Renderer& renderer)
controller_->set_viewport(region);
forward_input(hovered);
// The backend's framebuffer scale is the display's scale, so the renderer draws
// its logical style metrics at it: the same assertion above pins it positive,
// and the chrome is then the same physical size whatever surface the host
// renders into.
renderer.style().ui_scale = scale.x;
const u32 fb_w = static_cast<u32>(fb_w_f + 0.5f);
const u32 fb_h = static_cast<u32>(fb_h_f + 0.5f);
renderer.begin_frame(fb_w, fb_h, region);