Skip to content

Commit 1224324

Browse files
committed
(GL1) Fixes statistics font size
1 parent fa44a18 commit 1224324

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

gfx/drivers/gl1.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,29 @@ static void gl1_raster_font_render_msg(
840840
font->block->fullscreen = full_screen;
841841

842842
{
843-
unsigned width = gl->video_width;
844-
unsigned height = gl->video_height;
843+
/* gl->video_width/height holds the core's emulated frame size
844+
* (e.g. 256x224), not the window size — gl1 reuses that field
845+
* for texture upload bookkeeping. The font viewport must cover
846+
* the full window, so use screen_width/height instead. Fall
847+
* back to video_width/height if the context driver did not
848+
* report a screen size yet. */
849+
unsigned width = gl->screen_width
850+
? gl->screen_width : gl->video_width;
851+
unsigned height = gl->screen_height
852+
? gl->screen_height : gl->video_height;
845853
float inv_tex_size_x = 1.0f / font->tex_width;
846854
float inv_tex_size_y = 1.0f / font->tex_height;
847-
float inv_win_width = 1.0f / gl->vp.width;
848-
float inv_win_height = 1.0f / gl->vp.height;
855+
float inv_win_width;
856+
float inv_win_height;
857+
/* setup_viewport may change gl->vp, so capture inv_win_width/height
858+
* AFTER it runs — otherwise the vertex math uses one viewport while
859+
* the actual glViewport is another, producing stretched/squished
860+
* text. The block path defers setup_viewport to flush time and uses
861+
* gl->vp as-is. */
849862
if (!font->block)
850863
gl1_raster_font_setup_viewport(gl, width, height, font, full_screen);
864+
inv_win_width = 1.0f / gl->vp.width;
865+
inv_win_height = 1.0f / gl->vp.height;
851866

852867
if (msg && *msg
853868
&& font->font_data && font->font_driver)

0 commit comments

Comments
 (0)