iris-gui: scaling fixes and window resize - #111
Merged
Merged
Conversation
View > VM screen at 1x measured ~0.9x, and a window resized to ~1x lost rows of pixels. Separately, fullscreen ignored the setting and blew the picture up to a filtered 1.05x, and changing the scale while fullscreen shrank the whole UI into a corner. - snap_window_to_fb capped the window at 85% of the monitor, silently reducing the requested scale. Reserve only the measured title bar; no guessed menu bar/taskbar allowance either, since 1280x1024 at 1x on a 1080p screen has ~3 points to spare. If the window manager constrains the window anyway, the draw falls back to a filtered fit. Request 1pt of slack so WM rounding can't land just short of 1x. - is_integer_scale accepted scales within 1% of an integer and drew NEAREST at that slightly-off size, dropping rows. fb_draw_size now snaps a fit that lands just above an integer device scale down to exactly that integer (never up, which would clip), and uses LINEAR otherwise. - centered_and_justified put the image origin on a fractional device pixel. fb_draw_rect snaps the rect to the device-pixel grid and paint_fb paints it directly so layout doesn't re-round it. Both heads use it. - The VM screen setting is now the maximum draw scale: a larger window (fullscreen, maximised, manual resize) centres the picture at the chosen scale instead of stretching it; only a smaller window shrinks it to fit. - snap_window_to_fb doesn't resize a fullscreen window (InnerSize just shrank the rendered area); the request stays pending and is applied once fullscreen ends. Cross-platform, no new dependencies. Adds unit tests for the draw geometry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View > VM screen at 1x measured ~0.9x, and a window resized to ~1x lost rows of pixels. Separately, fullscreen ignored the setting and blew the picture up to a filtered 1.05x, and changing the scale while fullscreen shrank the whole UI into a corner.
snap_window_to_fb capped the window at 85% of the monitor, silently reducing the requested scale. Reserve only the measured title bar; no guessed menu bar/taskbar allowance either, since 1280x1024 at 1x on a 1080p screen has ~3 points to spare. If the window manager constrains the window anyway, the draw falls back to a filtered fit. Request 1pt of slack so WM rounding can't land just short of 1x.
is_integer_scale accepted scales within 1% of an integer and drew NEAREST at that slightly-off size, dropping rows. fb_draw_size now snaps a fit that lands just above an integer device scale down to exactly that integer (never up, which would clip), and uses LINEAR otherwise.
centered_and_justified put the image origin on a fractional device pixel. fb_draw_rect snaps the rect to the device-pixel grid and paint_fb paints it directly so layout doesn't re-round it. Both heads use it.
The VM screen setting is now the maximum draw scale: a larger window (fullscreen, maximised, manual resize) centres the picture at the chosen scale instead of stretching it; only a smaller window shrinks it to fit.
snap_window_to_fb doesn't resize a fullscreen window (InnerSize just shrank the rendered area); the request stays pending and is applied once fullscreen ends.
Cross-platform, no new dependencies. Adds unit tests for the draw geometry.