From: Toni Wilen Date: Sat, 19 Oct 2019 13:13:52 +0000 (+0300) Subject: Round 24-bit pixel width to prevent possible missing pixels. Extra safety check. X-Git-Tag: 4300~76 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=154e5db441570e7b709e33790ed16e5af1e28da8;p=francis%2Fwinuae.git Round 24-bit pixel width to prevent possible missing pixels. Extra safety check. --- diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index ef9a0a57..3879657f 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -5161,6 +5161,12 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid]; bool overlay_updated = false; + // safety check + if (pwidth * state->BytesPerPixel > vidinfo->rowbytes) + pwidth = vidinfo->rowbytes / state->BytesPerPixel; + if (pheight > vidinfo->height) + pheight = vidinfo->height; + src_start = src + (off & ~gwwpagemask[index]); src_end = src + ((off + state->BytesPerRow * pheight + gwwpagesize[index] - 1) & ~gwwpagemask[index]); #if 0 @@ -5259,7 +5265,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) y = realoffset / state->BytesPerRow; if (y < pheight) { - int w = gwwpagesize[index] / state->BytesPerPixel; + int w = (gwwpagesize[index] + state->BytesPerPixel - 1) / state->BytesPerPixel; x = (realoffset % state->BytesPerRow) / state->BytesPerPixel; if (x < pwidth) { copyrow(monid, src + off, dst, x, y, pwidth - x, @@ -5268,7 +5274,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert, p96_rgbx16); flushlines++; } - w = (gwwpagesize[index] - (state->BytesPerRow - x * state->BytesPerPixel)) / state->BytesPerPixel; + w = (gwwpagesize[index] - (state->BytesPerRow - x * state->BytesPerPixel) + state->BytesPerPixel - 1) / state->BytesPerPixel; if (y < miny) miny = y; y++;