From b9da161c63c7adb2f2d7d1978ff45d72513ae1c7 Mon Sep 17 00:00:00 2001 From: coderJeff Date: Wed, 21 Jun 2023 12:24:35 -0400 Subject: [PATCH] gfxlib2: unable to set opengl scaling after initial screen mode - unable to set set open GL scaling (with screencontrol(SET_GL_SCALE, 1)) after initial mode with greater than 1 is set - due to bad logic in the driver initialization - gfxlib stores the scaling requested for the next mode and the logic was only setting the new scaling if it was > 1, which prevents setting the scaling to 1 --- changelog.txt | 3 ++- src/gfxlib2/unix/gfx_driver_opengl_x11.c | 4 +++- src/gfxlib2/win32/gfx_driver_opengl.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 144eb8955..6fe368a27 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,9 +5,10 @@ Version 1.10.1 [added] [fixed] -- sf.net #982: Array descriptors emitted incorrectly in gcc backend +- sf.net #982: Array descriptors emitted incorrectly in gcc backend - gas64: emit debug information for statics - gas64: handle #inf's and NaN's in float comparisons +- unable to set opengl scaling to 1 after initial screen mode - previously: logic error in the driver code prevented the scaling from being set to 1 Version 1.10.0 diff --git a/src/gfxlib2/unix/gfx_driver_opengl_x11.c b/src/gfxlib2/unix/gfx_driver_opengl_x11.c index 03eed0a62..d63c0e733 100644 --- a/src/gfxlib2/unix/gfx_driver_opengl_x11.c +++ b/src/gfxlib2/unix/gfx_driver_opengl_x11.c @@ -222,8 +222,10 @@ static int driver_init(char *title, int w, int h, int depth, int refresh_rate, i __fb_gl_params.mode_2d = __fb_gl_params.init_mode_2d; - if (__fb_gl_params.init_scale>1){ + if (__fb_gl_params.init_scale>=1){ __fb_gl_params.scale = __fb_gl_params.init_scale; + } + if (__fb_gl_params.scale>1){ free(__fb_gfx->dirty); __fb_gfx->dirty = (char *)calloc(1, __fb_gfx->h * __fb_gfx->scanline_size * __fb_gl_params.scale); } diff --git a/src/gfxlib2/win32/gfx_driver_opengl.c b/src/gfxlib2/win32/gfx_driver_opengl.c index 83bd50808..1e1c0405a 100644 --- a/src/gfxlib2/win32/gfx_driver_opengl.c +++ b/src/gfxlib2/win32/gfx_driver_opengl.c @@ -435,8 +435,10 @@ static int driver_init(char *title, int w, int h, int depth_arg, int refresh_rat __fb_gl_params.mode_2d = __fb_gl_params.init_mode_2d; - if (__fb_gl_params.init_scale>1){ + if (__fb_gl_params.init_scale>=1){ __fb_gl_params.scale = __fb_gl_params.init_scale; + } + if (__fb_gl_params.scale>1){ free(__fb_gfx->dirty); __fb_gfx->dirty = (char *)calloc(1, __fb_gfx->h * __fb_gfx->scanline_size * __fb_gl_params.scale); w *= __fb_gl_params.scale;