Skip to content

Redraw frame on scale factor change in tiny_skia - #3531

Open
whiteo wants to merge 1 commit into
iced-rs:masterfrom
whiteo:tiny-skia-scale-factor-damage
Open

whiteo wants to merge 1 commit into
iced-rs:masterfrom
whiteo:tiny-skia-scale-factor-damage

Conversation

@whiteo

@whiteo whiteo commented Nov 5, 2026

Copy link
Copy Markdown

present diffs the previous frame's layers against the new ones to find the damage. Both sets of bounds are in logical units, and the frame only records its background colour, so a change of Application::scale_factor leaves anything whose logical bounds did not move undamaged. Those pixels stay on screen at the old scale while text and moved widgets are drawn at the new one: backgrounds, borders and button fills end up offset from their labels until something repaints the whole window.

The window's own DPI change does not hit this, because WindowEvent::ScaleFactorChanged bumps surface_version and configure_surface clears the frames.
State::synchronize updates the viewport for a new application scale factor without doing that.

Repro: an app whose scale_factor comes from its state (a zoom), run with ICED_BACKEND=tiny-skia, change the zoom. The wgpu backend redraws every frame and is not affected.

Fix: keep the scale factor in Frame and compare it together with the background, the same way a background change already forces a full redraw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant