gfx: rename {fpga,gdi}_t::video_{width,height,pitch,bits} to frame_*

Same rename as gfx/gl1 in d654940, applied to the FPGA and GDI
drivers for consistency.  The four `video_*` fields on each driver
struct hold the libretro core's emulated frame size — assigned from
`video->width` / `video->height` at init and updated from
`frame_width` / `frame_height` per-call — not the window or
backbuffer size.  Both drivers already have separate fields for the
distinct concepts they track:

  fpga_t:  menu_width / menu_height / menu_pitch / menu_bits
           (the menu surface, sibling to the core frame group)

  gdi_t:   screen_width / screen_height (actual surface size)
           full_width / full_height     (window size last published
                                         via video_driver_set_size)
           bmp_width / bmp_height       (DDB's own size)
           menu_width / menu_height / menu_pitch / menu_bits

For gdi, the semantic mismatch was already partially documented in
two defensive comments in gdi_defines.h (lines 114-116 and 119-124
before this commit) and one in gdi_gfx.c (around line 2853).
Renaming the fields lets those comments shrink: the field name now
says what it is, so the explanations no longer need to warn the
reader off the wrong reading.

Rename in both drivers:

  video_width  -> frame_width
  video_height -> frame_height
  video_pitch  -> frame_pitch
  video_bits   -> frame_bits

fpga_t is file-private (declared at the top of fpga_gfx.c with no
header counterpart): the rename is contained to that one file, 11
reference sites plus the four declarations.

gdi_t lives in the shared header gfx/common/gdi_defines.h, used by
both gfx/drivers/gdi_gfx.c and gfx/common/win32_common.c (the
shared WM_PAINT body for the three GDI window procs).  20 reference
sites updated in gdi_gfx.c, 3 in win32_common.c, plus the four
declarations and three comment rewrites.  No callers outside these
three files (verified by grep across the source tree).

Same risk profile as gl1: pure rename, no behavior change, no new
code paths.  Causes future cross-driver copy-paste from gl2 / gl3
to fail at compile time (`fpga->video_width` / `gdi->video_width`
no longer exist) instead of silently producing a different result.

Verified that no stale `fpga->video_(...)` or `gdi->video_(...)`
field references remain, and that the renamed fields compile clean
at -std=c89 -pedantic against stub harnesses.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-05-01 04:18:37 +02:00
1 parent d6549402d3
commit 61ce292dca
4 files changed
+51 -52

No files matched your search

+7 -8
View File
@@ -107,19 +107,18 @@ typedef struct gdi
unsigned scratch_rgui_w;
unsigned scratch_rgui_h;
unsigned video_width;
unsigned video_height;
unsigned frame_width;
unsigned frame_height;
unsigned screen_width;
unsigned screen_height;
/* Surface (window) size last published via video_driver_set_size,
* tracked here so gdi_alive can read it without locking. Distinct
* from video_width / video_height which is the core's frame size. */
* tracked here so gdi_alive can read it without locking. */
unsigned full_width;
unsigned full_height;
/* Actual size of gdi->bmp (the DDB). Separate from video_width
/* Actual size of gdi->bmp (the DDB). Separate from frame_width
* because when RGUI is active we draw the menu (a different size
* than the core) into bmp; without a dedicated tracker, the
* comparison against video_width would trigger a destructive
* comparison against frame_width would trigger a destructive
* DeleteObject + CreateCompatibleBitmap on every frame, racing
* with WM_PAINT and producing visible flicker. */
unsigned bmp_width;
@@ -128,8 +127,8 @@ typedef struct gdi
unsigned menu_width;
unsigned menu_height;
unsigned menu_pitch;
unsigned video_pitch;
unsigned video_bits;
unsigned frame_pitch;
unsigned frame_bits;
unsigned menu_bits;
int win_major;
int win_minor;
+4 -4
View File
@@ -1345,16 +1345,16 @@ static LRESULT wnd_proc_wm_gdi_create(HWND hwnd)
* outside the rect with black to produce letterbox / pillarbox
* bars. Reads bmp_width / bmp_height for the source rect (the
* DDB's actual size); when RGUI is alive bmp holds the menu image
* at the menu's resolution while gdi->video_width still tracks
* the core, so video_width is only the fallback. */
* at the menu's resolution while gdi->frame_width still tracks
* the core, so frame_width is only the fallback. */
static void wnd_proc_gdi_paint(gdi_t *gdi)
{
int vp_x = gdi->vp.x;
int vp_y = gdi->vp.y;
unsigned vp_w = gdi->vp.width ? gdi->vp.width : gdi->screen_width;
unsigned vp_h = gdi->vp.height ? gdi->vp.height : gdi->screen_height;
unsigned src_w = gdi->bmp_width ? gdi->bmp_width : gdi->video_width;
unsigned src_h = gdi->bmp_height ? gdi->bmp_height : gdi->video_height;
unsigned src_w = gdi->bmp_width ? gdi->bmp_width : gdi->frame_width;
unsigned src_h = gdi->bmp_height ? gdi->bmp_height : gdi->frame_height;
/* Letterbox / pillarbox bars: paint the four areas outside the
* viewport rect black before the StretchBlt. We do this even
+19 -19
View File
@@ -57,10 +57,10 @@ typedef struct fpga
unsigned menu_width;
unsigned menu_height;
unsigned menu_pitch;
unsigned video_width;
unsigned video_height;
unsigned video_pitch;
unsigned video_bits;
unsigned frame_width;
unsigned frame_height;
unsigned frame_pitch;
unsigned frame_bits;
unsigned menu_bits;
bool rgb32;
} fpga_t;
@@ -138,16 +138,16 @@ static void *fpga_init(const video_info_t *video,
*input = NULL;
*input_data = NULL;
fpga->video_width = video->width;
fpga->video_height = video->height;
fpga->frame_width = video->width;
fpga->frame_height = video->height;
fpga->rgb32 = video->rgb32;
fpga->video_bits = video->rgb32 ? 32 : 16;
fpga->frame_bits = video->rgb32 ? 32 : 16;
if (video->rgb32)
fpga->video_pitch = video->width * 4;
fpga->frame_pitch = video->width * 4;
else
fpga->video_pitch = video->width * 2;
fpga->frame_pitch = video->width * 2;
fpga_create(fpga);
@@ -168,7 +168,7 @@ static bool fpga_frame(void *data, const void *frame,
unsigned height = 0;
bool draw = true;
fpga_t *fpga = (fpga_t*)data;
unsigned bits = fpga->video_bits;
unsigned bits = fpga->frame_bits;
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
@@ -180,15 +180,15 @@ static bool fpga_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( (fpga->video_width != frame_width)
|| (fpga->video_height != frame_height)
|| (fpga->video_pitch != pitch))
if ( (fpga->frame_width != frame_width)
|| (fpga->frame_height != frame_height)
|| (fpga->frame_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{
fpga->video_width = frame_width;
fpga->video_height = frame_height;
fpga->video_pitch = pitch;
fpga->frame_width = frame_width;
fpga->frame_height = frame_height;
fpga->frame_pitch = pitch;
}
}
@@ -204,9 +204,9 @@ static bool fpga_frame(void *data, const void *frame,
else
#endif
{
width = fpga->video_width;
height = fpga->video_height;
pitch = fpga->video_pitch;
width = fpga->frame_width;
height = fpga->frame_height;
pitch = fpga->frame_pitch;
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
draw = false;
+21 -21
View File
@@ -2171,8 +2171,8 @@ static void gdi_font_render_msg(
else
{
dst_bmp = gdi->bmp;
width = gdi->bmp_width ? gdi->bmp_width : gdi->video_width;
height = gdi->bmp_height ? gdi->bmp_height : gdi->video_height;
width = gdi->bmp_width ? gdi->bmp_width : gdi->frame_width;
height = gdi->bmp_height ? gdi->bmp_height : gdi->frame_height;
}
if (!dst_bmp || !width || !height)
@@ -2474,16 +2474,16 @@ static void *gdi_init(const video_info_t *video,
*input = NULL;
*input_data = NULL;
gdi->video_width = video->width;
gdi->video_height = video->height;
gdi->frame_width = video->width;
gdi->frame_height = video->height;
gdi->rgb32 = video->rgb32;
gdi->video_bits = video->rgb32 ? 32 : 16;
gdi->frame_bits = video->rgb32 ? 32 : 16;
if (video->rgb32)
gdi->video_pitch = video->width * 4;
gdi->frame_pitch = video->width * 4;
else
gdi->video_pitch = video->width * 2;
gdi->frame_pitch = video->width * 2;
/* Aspect-ratio handling. Pulled from video_info_t at init the
* same way d3d8/d3d9 do it; the user can override via the
@@ -2575,7 +2575,7 @@ static bool gdi_frame(void *data, const void *frame,
unsigned height = 0;
bool draw = true;
gdi_t *gdi = (gdi_t*)data;
unsigned bits = gdi->video_bits;
unsigned bits = gdi->frame_bits;
HWND hwnd = win32_get_window();
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE)
@@ -2639,8 +2639,8 @@ static bool gdi_frame(void *data, const void *frame,
gdi->winDC, frame_width, frame_height);
gdi->bmp_width = frame_width;
gdi->bmp_height = frame_height;
gdi->video_width = frame_width;
gdi->video_height = frame_height;
gdi->frame_width = frame_width;
gdi->frame_height = frame_height;
}
/* --- Step 2: figure out the on-screen surface size. */
@@ -2788,7 +2788,7 @@ static bool gdi_frame(void *data, const void *frame,
&& frame_height > 4)
{
gdi_upload_core_frame_to_menu(gdi, frame,
frame_width, frame_height, pitch, gdi->video_bits);
frame_width, frame_height, pitch, gdi->frame_bits);
}
#endif
@@ -2803,15 +2803,15 @@ static bool gdi_frame(void *data, const void *frame,
/* --- Step 6: track core-frame size changes (needed for both the
* RGUI-overlay path and the no-menu path). We resize bmp here
* if the core's announced dimensions changed. */
if ( (gdi->video_width != frame_width)
|| (gdi->video_height != frame_height)
|| (gdi->video_pitch != pitch))
if ( (gdi->frame_width != frame_width)
|| (gdi->frame_height != frame_height)
|| (gdi->frame_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{
gdi->video_width = frame_width;
gdi->video_height = frame_height;
gdi->video_pitch = pitch;
gdi->frame_width = frame_width;
gdi->frame_height = frame_height;
gdi->frame_pitch = pitch;
}
}
@@ -2832,9 +2832,9 @@ static bool gdi_frame(void *data, const void *frame,
else
#endif
{
width = gdi->video_width;
height = gdi->video_height;
pitch = gdi->video_pitch;
width = gdi->frame_width;
height = gdi->frame_height;
pitch = gdi->frame_pitch;
if ( frame_width == 4
&& frame_height == 4
@@ -2850,7 +2850,7 @@ static bool gdi_frame(void *data, const void *frame,
/* --- Step 8: resize bmp if its current size doesn't match the
* effective draw target size (width/height computed in Step 7).
* We compare against bmp_width/bmp_height (the DDB's own size),
* NOT video_width — the latter holds the core's announced frame
* NOT frame_width — the latter holds the core's announced frame
* size, which can legitimately differ from the menu's frame size
* when RGUI is alive. Conflating the two causes a destructive
* recreate every frame as Steps 6 and 8 fight over the field. */