From 06805b28fbb85af38260ac14b7f89f83ee334859 Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 27 Mar 2020 13:57:08 +0100 Subject: [PATCH] Change bpp to unsigned int around render code Max value of bpp is 32, so there's really no reason to tie this variable to architecture size. This change prevents few -Wformat warnings. --- include/render.h | 6 +++--- src/gui/render.cpp | 18 ++++++++++-------- src/hardware/vga_draw.cpp | 13 ++++++------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/render.h b/include/render.h index fde53d9b..22cd65e9 100644 --- a/include/render.h +++ b/include/render.h @@ -52,7 +52,7 @@ typedef struct { struct { Bitu width, start; Bitu height; - Bitu bpp; + unsigned bpp; bool dblw,dblh; double ratio; float fps; @@ -93,12 +93,12 @@ typedef struct { extern Render_t render; extern ScalerLineHandler_t RENDER_DrawLine; -void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh); +void RENDER_SetSize(Bitu width, Bitu height, unsigned bpp, float fps, + double ratio, bool dblw, bool dblh); bool RENDER_StartUpdate(void); void RENDER_EndUpdate(bool abort); void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue); bool RENDER_GetForceUpdate(void); void RENDER_SetForceUpdate(bool); - #endif diff --git a/src/gui/render.cpp b/src/gui/render.cpp index c2d1e2aa..60f4b7fd 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -547,7 +547,9 @@ static void RENDER_CallBack( GFX_CallBackFunctions_t function ) { } } -void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh) { +void RENDER_SetSize(Bitu width, Bitu height, unsigned bpp, float fps, + double ratio, bool dblw, bool dblh) +{ RENDER_Halt( ); if (!width || !height || width > SCALER_MAXWIDTH || height > SCALER_MAXHEIGHT) { return; @@ -558,13 +560,13 @@ void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool } else { //This would alter the width of the screen, we don't care about rounding errors here } - render.src.width=width; - render.src.height=height; - render.src.bpp=bpp; - render.src.dblw=dblw; - render.src.dblh=dblh; - render.src.fps=fps; - render.src.ratio=ratio; + render.src.width = width; + render.src.height = height; + render.src.bpp = bpp; + render.src.dblw = dblw; + render.src.dblh = dblh; + render.src.fps = fps; + render.src.ratio = ratio; RENDER_Reset( ); } diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index c0902d80..53a4e312 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -1334,8 +1334,7 @@ void VGA_SetupDrawing(Bitu /*val*/) { bool doubleheight=false; bool doublewidth=false; - //Set the bpp - Bitu bpp; + unsigned bpp; switch (vga.mode) { case M_LIN15: bpp = 15; @@ -1357,7 +1356,7 @@ void VGA_SetupDrawing(Bitu /*val*/) { doublewidth=true; width<<=2; if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) { - bpp=16; + bpp = 16; VGA_DrawLine = VGA_Draw_Xlat16_Linear_Line; } else VGA_DrawLine = VGA_Draw_Linear_Line; break; @@ -1408,7 +1407,7 @@ void VGA_SetupDrawing(Bitu /*val*/) { width<<=3; if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) { // This would also be required for EGA in Spacepigs Megademo - bpp=16; + bpp = 16; VGA_DrawLine = VGA_Draw_Xlat16_Linear_Line; } else VGA_DrawLine=VGA_Draw_Linear_Line; @@ -1448,7 +1447,7 @@ void VGA_SetupDrawing(Bitu /*val*/) { aspect_ratio*=1.125; } VGA_DrawLine=VGA_TEXT_Xlat16_Draw_Line; - bpp=16; + bpp = 16; } else { // not vgaonly: force 8-pixel wide fonts width*=8; // 8 bit wide text font @@ -1603,9 +1602,9 @@ void VGA_SetupDrawing(Bitu /*val*/) { LOG(LOG_VGA,LOG_NORMAL)("%s width, %s height aspect %f", doublewidth ? "double":"normal",doubleheight ? "double":"normal",aspect_ratio); #endif - if (!vga.draw.vga_override) + if (!vga.draw.vga_override) RENDER_SetSize(width, height, bpp, (float)fps, aspect_ratio, - doublewidth, doubleheight); + doublewidth, doubleheight); } }