This fixes numerous comments complaining about fix_viewport_ratio being used in render functions by instead calculating the viewport whenever the window is resized with a new, similar function in graphics.c. Doing this also allows the integer scaling state to be precalculated for all scaling renderers, which helps mainly opengl2 right now (but could be extended to opengl1 and glsl). The longstanding "FIXME" about the ratio being calculated using floats has also been resolved.
There are two places where this couldn't be fully fixed: opengl2 and glsl using the viewport variables in render_layer to set the viewport every time a layer is rendered. Doing this correctly requires a new start of frame callback, which would be a good idea for other reasons (charset and palette update).
[x] get_screen_coords_scaled/set_screen_coords_scaled also need to use the new render viewport variables.
[x] The GX renderer viewport setup uses fix_viewport_ratio to generate the viewport in an unusal way and it needs to be converted.
This fixes numerous comments complaining about
fix_viewport_ratio
being used in render functions by instead calculating the viewport whenever the window is resized with a new, similar function in graphics.c. Doing this also allows the integer scaling state to be precalculated for all scaling renderers, which helps mainlyopengl2
right now (but could be extended toopengl1
andglsl
). The longstanding "FIXME" about the ratio being calculated using floats has also been resolved.There are two places where this couldn't be fully fixed:
opengl2
andglsl
using the viewport variables inrender_layer
to set the viewport every time a layer is rendered. Doing this correctly requires a new start of frame callback, which would be a good idea for other reasons (charset and palette update).get_screen_coords_scaled
/set_screen_coords_scaled
also need to use the new render viewport variables.fix_viewport_ratio
to generate the viewport in an unusal way and it needs to be converted.