diff options
author | Phil Bennett <philipjbennett@users.noreply.github.com> | 2010-07-26 11:55:21 +0000 |
---|---|---|
committer | Phil Bennett <philipjbennett@users.noreply.github.com> | 2010-07-26 11:55:21 +0000 |
commit | 2843028b6b039bf7bdd9fac644a213c87df1b8d6 (patch) | |
tree | 02a92358e69522f06c0200e072d85fa593ede654 | |
parent | 6df9f06efeb1bd802e2e6b2ea56bad98431a77db (diff) |
03318: -burnin causes crash in vector games [Atari Ace]
---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>
Date: Sun, Jul 18, 2010 at 9:43 PM
Subject: [patch] Fix 03318: -burnin causes crash in vector games
To: submit@mamedev.org
Cc: atariace@hotmail.com
- Hide quoted text -
Hi mamedev,
This patch fixes bug 03318, a crash associated with -burnin on vector
games. -burnin doesn't work for vector games (they lack bitmaps), but
at least it won't crash anymore. I also fixed the code to not assume
the bitmaps were identically sized. update_burnin made that
assumption, but finalize_burnin did not in some places.
~aa
-rw-r--r-- | src/emu/video.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/emu/video.c b/src/emu/video.c index 918db7259e2..d4c7bc49e7e 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -2415,6 +2415,9 @@ void screen_device::update_burnin() return; bitmap_t *srcbitmap = m_bitmap[m_curtexture]; + if (srcbitmap == NULL) + return; + int srcwidth = srcbitmap->width; int srcheight = srcbitmap->height; int dstwidth = m_burnin->width; @@ -2490,27 +2493,37 @@ void screen_device::finalize_burnin() scaledvis.max_y + 1 - scaledvis.min_y, BITMAP_FORMAT_ARGB32)); + int srcwidth = m_burnin->width; + int srcheight = m_burnin->height; + int dstwidth = finalmap->width; + int dstheight = finalmap->height; + int xstep = (srcwidth << 16) / dstwidth; + int ystep = (srcheight << 16) / dstheight; + // find the maximum value UINT64 minval = ~(UINT64)0; UINT64 maxval = 0; - for (int y = 0; y < finalmap->height; y++) + for (int y = 0; y < srcheight; y++) { UINT64 *src = BITMAP_ADDR64(m_burnin, y, 0); - for (int x = 0; x < finalmap->width; x++) + for (int x = 0; x < srcwidth; x++) { minval = MIN(minval, src[x]); maxval = MAX(maxval, src[x]); } } + if (minval == maxval) + return; + // now normalize and convert to RGB - for (int y = 0; y < finalmap->height; y++) + for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - UINT64 *src = BITMAP_ADDR64(m_burnin, y, 0); + UINT64 *src = BITMAP_ADDR64(m_burnin, srcy >> 16, 0); UINT32 *dst = BITMAP_ADDR32(finalmap, y, 0); - for (int x = 0; x < finalmap->width; x++) + for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { - int brightness = (UINT64)(maxval - src[x]) * 255 / (maxval - minval); + int brightness = (UINT64)(maxval - src[srcx >> 16]) * 255 / (maxval - minval); dst[x] = MAKE_ARGB(0xff, brightness, brightness, brightness); } } |