mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Merge branch 'master' into next
This commit is contained in:
commit
058ad4df88
1 changed files with 52 additions and 51 deletions
103
src/v_video.c
103
src/v_video.c
|
@ -758,79 +758,80 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||||
{
|
{
|
||||||
UINT8 *dest;
|
UINT8 *dest;
|
||||||
const UINT8 *deststop;
|
const UINT8 *deststop;
|
||||||
INT32 u, v, dupx, dupy;
|
|
||||||
|
if (rendermode == render_none)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode != render_soft && !con_startup)
|
||||||
{
|
{
|
||||||
HWR_DrawFill(x, y, w, h, c);
|
HWR_DrawFill(x, y, w, h, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dupx = vid.dupx;
|
if (!(c & V_NOSCALESTART))
|
||||||
dupy = vid.dupy;
|
|
||||||
|
|
||||||
if (!screens[0])
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (c & V_NOSCALESTART)
|
|
||||||
{
|
|
||||||
dest = screens[0] + y*vid.width + x;
|
|
||||||
deststop = screens[0] + vid.rowbytes * vid.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
INT32 dupx = vid.dupx, dupy = vid.dupy;
|
||||||
|
|
||||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||||
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
|
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
|
||||||
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
|
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest = screens[0] + y*dupy*vid.width + x*dupx;
|
x *= dupx;
|
||||||
deststop = screens[0] + vid.rowbytes * vid.height;
|
y *= dupy;
|
||||||
|
w *= dupx;
|
||||||
|
h *= dupy;
|
||||||
|
|
||||||
if (w == BASEVIDWIDTH)
|
// Center it if necessary
|
||||||
w = vid.width;
|
if (vid.width != BASEVIDWIDTH * dupx)
|
||||||
else
|
|
||||||
w *= dupx;
|
|
||||||
if (h == BASEVIDHEIGHT)
|
|
||||||
h = vid.height;
|
|
||||||
else
|
|
||||||
h *= dupy;
|
|
||||||
|
|
||||||
if (x && y && x + w < vid.width && y + h < vid.height)
|
|
||||||
{
|
{
|
||||||
// Center it if necessary
|
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
|
||||||
if (vid.width != BASEVIDWIDTH * dupx)
|
// so center this imaginary screen
|
||||||
{
|
if (c & V_SNAPTORIGHT)
|
||||||
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
|
x += (vid.width - (BASEVIDWIDTH * dupx));
|
||||||
// so center this imaginary screen
|
else if (!(c & V_SNAPTOLEFT))
|
||||||
if (c & V_SNAPTORIGHT)
|
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
||||||
dest += (vid.width - (BASEVIDWIDTH * dupx));
|
}
|
||||||
else if (!(c & V_SNAPTOLEFT))
|
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||||
dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
{
|
||||||
}
|
// same thing here
|
||||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
if (c & V_SNAPTOBOTTOM)
|
||||||
{
|
y += (vid.height - (BASEVIDHEIGHT * dupy));
|
||||||
// same thing here
|
else if (!(c & V_SNAPTOTOP))
|
||||||
if (c & V_SNAPTOBOTTOM)
|
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||||
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width;
|
|
||||||
else if (!(c & V_SNAPTOTOP))
|
|
||||||
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x >= vid.width || y >= vid.height)
|
||||||
|
return; // off the screen
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
w += x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
h += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w <= 0 || h <= 0)
|
||||||
|
return; // zero width/height wouldn't draw anything
|
||||||
|
if (x + w > vid.width)
|
||||||
|
w = vid.width - x;
|
||||||
|
if (y + h > vid.height)
|
||||||
|
h = vid.height - y;
|
||||||
|
|
||||||
|
dest = screens[0] + y*vid.width + x;
|
||||||
|
deststop = screens[0] + vid.rowbytes * vid.height;
|
||||||
|
|
||||||
c &= 255;
|
c &= 255;
|
||||||
|
|
||||||
for (v = 0; v < h; v++, dest += vid.width)
|
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||||
for (u = 0; u < w; u++)
|
memset(dest, (UINT8)(c&255), w * vid.bpp);
|
||||||
{
|
|
||||||
if (dest > deststop)
|
|
||||||
return;
|
|
||||||
dest[u] = (UINT8)c;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue