feat(render): logical style metrics with a UI scale, so chrome has a consistent physical size
This commit is contained in:
1 parent
1f03631e98
commit
7500fc90d2
21 files changed
+708
-82
No files matched your search
@@ -179,6 +179,11 @@ void PlotWidget::paintGL() {
|
||||
last_paint_s_ = started;
|
||||
if (frame_) frame_(*plot_, dt);
|
||||
|
||||
// The same factor `device_viewport()` scales the widget by: it states the display
|
||||
// for the renderer too, so the logical style metrics are drawn at this ratio and
|
||||
// a 12 px label keeps its physical size on a 2x screen. Re-read every frame, like
|
||||
// the viewport, so a window moved to another display is drawn at *its* scale.
|
||||
renderer_->style().ui_scale = static_cast<f32>(devicePixelRatioF());
|
||||
renderer_->begin_frame(static_cast<u32>(viewport.w), static_cast<u32>(viewport.h), viewport);
|
||||
renderer_->draw(*plot_);
|
||||
renderer_->end_frame();
|
||||
|
||||
Reference in new issue
Block a user