Commit e32ae26
rgui: don't pre-center custom viewport (fixes right-aligned menu)
Since 439c672 ("Support viewport bias with integer overscale and
custom aspect ratios"), the ASPECT_RATIO_CUSTOM path in
video_viewport_get_scaled_aspect2() / video_viewport_get_scaled_integer()
positions the custom viewport as:
x = custom_vp->x;
padding_x = vp_width - custom_vp->width; (positive when the menu is
narrower than the screen)
x += padding_x * vp_bias_x; (default bias 0.5)
i.e. the driver now centers the custom viewport itself via the viewport
bias. RGUI, however, was *also* baking the centering into the viewport it
hands to the driver:
vp.x = (full_width - width) / 2;
so the offset was applied twice. On a wide screen with a 4:3 menu aspect
the menu ended up flush against the right edge (and the bottom), and
because RGUI writes these values into the shared settings->video_vp_custom,
opening the menu in-game also shifted the content viewport and left it
shifted afterwards.
Set the base position to 0 and let the driver's bias logic do the
centering (default 0.5 == centered), matching how every other
custom-viewport consumer is now expected to behave. All in-tree video
drivers route their viewport through video_driver_update_viewport(), so
none position RGUI from custom_vp->x directly.
Fixes a regression reported on KMSDRM + GL (Pi4, aarch64); driver-
independent.1 parent 132a4d1 commit e32ae26
1 file changed
Lines changed: 9 additions & 2 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6263 | 6263 | | |
6264 | 6264 | | |
6265 | 6265 | | |
6266 | | - | |
6267 | | - | |
| 6266 | + | |
| 6267 | + | |
| 6268 | + | |
| 6269 | + | |
| 6270 | + | |
| 6271 | + | |
| 6272 | + | |
| 6273 | + | |
| 6274 | + | |
6268 | 6275 | | |
6269 | 6276 | | |
6270 | 6277 | | |
| |||
0 commit comments