Merge branch 'master' into next

This commit is contained in:
Monster Iestyn 2017-04-26 16:15:40 +01:00
commit 058ad4df88

View file

@ -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;
if (w == BASEVIDWIDTH)
w = vid.width;
else
w *= dupx; w *= dupx;
if (h == BASEVIDHEIGHT)
h = vid.height;
else
h *= dupy; h *= dupy;
if (x && y && x + w < vid.width && y + h < vid.height)
{
// Center it if necessary // Center it if necessary
if (vid.width != BASEVIDWIDTH * dupx) if (vid.width != BASEVIDWIDTH * dupx)
{ {
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
// so center this imaginary screen // so center this imaginary screen
if (c & V_SNAPTORIGHT) if (c & V_SNAPTORIGHT)
dest += (vid.width - (BASEVIDWIDTH * dupx)); x += (vid.width - (BASEVIDWIDTH * dupx));
else if (!(c & V_SNAPTOLEFT)) else if (!(c & V_SNAPTOLEFT))
dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2; x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
} }
if (vid.height != BASEVIDHEIGHT * dupy) if (vid.height != BASEVIDHEIGHT * dupy)
{ {
// same thing here // same thing here
if (c & V_SNAPTOBOTTOM) if (c & V_SNAPTOBOTTOM)
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width; y += (vid.height - (BASEVIDHEIGHT * dupy));
else if (!(c & V_SNAPTOTOP)) else if (!(c & V_SNAPTOTOP))
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2; y += (vid.height - (BASEVIDHEIGHT * dupy)) / 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;
}
} }
// //