diff options
author | 2012-01-02 07:37:22 +0000 | |
---|---|---|
committer | 2012-01-02 07:37:22 +0000 | |
commit | 70a40085ebc14e1961486957bcefc80485c7ab20 (patch) | |
tree | aa096722e26c7559bcc523da79becff2b77c054d | |
parent | 6130a83ecd7278097eb2d072a7142115d9b4e3fe (diff) |
Removed machine.generic.tmpbitmap, VIDEO_START(generic_bitmapped),
and SCREEN_UPDATE(generic_bitmapped). In their place, each screen_device
now maintains a default bitmap which is automatically copied to the
screen on each update if no SCREEN_UPDATE function is provided and if
no driver_device::video_update override is present. This bitmap can be
found by querying the screen's new default_bitmap() method. [Aaron Giles]
-rw-r--r-- | src/emu/drawgfxm.h | 14 | ||||
-rw-r--r-- | src/emu/machine.c | 2 | ||||
-rw-r--r-- | src/emu/machine.h | 1 | ||||
-rw-r--r-- | src/emu/rendutil.c | 53 | ||||
-rw-r--r-- | src/emu/rendutil.h | 1 | ||||
-rw-r--r-- | src/emu/screen.c | 102 | ||||
-rw-r--r-- | src/emu/screen.h | 8 | ||||
-rw-r--r-- | src/emu/tilemap.c | 44 | ||||
-rw-r--r-- | src/emu/video.c | 26 | ||||
-rw-r--r-- | src/emu/video.h | 2 | ||||
-rw-r--r-- | src/emu/video/generic.c | 32 | ||||
-rw-r--r-- | src/emu/video/generic.h | 6 | ||||
-rw-r--r-- | src/mame/drivers/3do.c | 5 | ||||
-rw-r--r-- | src/mame/drivers/adp.c | 9 | ||||
-rw-r--r-- | src/mame/drivers/big10.c | 4 | ||||
-rw-r--r-- | src/mame/drivers/gei.c | 5 | ||||
-rw-r--r-- | src/mame/drivers/kas89.c | 4 | ||||
-rw-r--r-- | src/mame/drivers/sangho.c | 5 | ||||
-rw-r--r-- | src/mame/drivers/sfkick.c | 4 | ||||
-rw-r--r-- | src/mame/drivers/sothello.c | 4 | ||||
-rw-r--r-- | src/mame/includes/naughtyb.h | 1 | ||||
-rw-r--r-- | src/mame/includes/tunhunt.h | 1 | ||||
-rw-r--r-- | src/mame/video/atari.c | 6 | ||||
-rw-r--r-- | src/mame/video/galpanic.c | 7 | ||||
-rw-r--r-- | src/mame/video/magmax.c | 8 | ||||
-rw-r--r-- | src/mame/video/mcd212.c | 5 | ||||
-rw-r--r-- | src/mame/video/naughtyb.c | 4 | ||||
-rw-r--r-- | src/mame/video/tunhunt.c | 4 | ||||
-rw-r--r-- | src/mame/video/zac2650.c | 5 |
29 files changed, 173 insertions, 199 deletions
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index a1e5bb570ee..617c641d2f7 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -804,14 +804,14 @@ do { \ /* Assumed input parameters or local variables: - bitmap_t *dest - the bitmap to copy to - bitmap_t *src - the bitmap to copy from (must be same bpp as dest) + bitmap_t &dest - the bitmap to copy to + bitmap_t &src - the bitmap to copy from (must be same bpp as dest) const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') int flipx - non-zero means render right-to-left instead of left-to-right int flipy - non-zero means render bottom-to-top instead of top-to-bottom INT32 destx - the top-left X coordinate to copy to INT32 desty - the top-left Y coordinate to copy to - bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) + bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ #define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ @@ -978,8 +978,8 @@ do { \ /* Assumed input parameters or local variables: - bitmap_t *dest - the bitmap to copy to - bitmap_t *src - the bitmap to copy from (must be same bpp as dest) + bitmap_t &dest - the bitmap to copy to + bitmap_t &src - the bitmap to copy from (must be same bpp as dest) const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') INT32 destx - the 16.16 source X position at destination pixel (0,0) INT32 desty - the 16.16 source Y position at destination pixel (0,0) @@ -988,7 +988,7 @@ do { \ INT32 incxy - the 16.16 amount to increment in source X for each destination Y pixel INT32 incyy - the 16.16 amount to increment in source Y for each destination Y pixel int wraparound - non-zero means wrap when hitting the edges of the source - bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) + bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ #define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ @@ -1284,7 +1284,7 @@ do { \ INT32 desty - the Y coordinate to copy to INT32 length - the total number of pixels to copy const UINTx *srcptr - pointer to memory containing the source pixels - bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) + bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ #define DRAWSCANLINE_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ diff --git a/src/emu/machine.c b/src/emu/machine.c index 36942683d50..a4a65cbc0e2 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -1116,6 +1116,8 @@ void driver_device::video_reset() bool driver_device::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) { + // if nothing provided, just copy the screen's generic bitmap + copybitmap(bitmap, screen.default_bitmap(), 0, 0, 0, 0, cliprect); return 0; } diff --git a/src/emu/machine.h b/src/emu/machine.h index cf58658ad15..ec6b02f140b 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -268,7 +268,6 @@ struct generic_pointers generic_ptr buffered_spriteram2;// secondary buffered spriteram generic_ptr paletteram; // palette RAM generic_ptr paletteram2; // secondary palette RAM - bitmap_t * tmpbitmap; // temporary bitmap }; diff --git a/src/emu/rendutil.c b/src/emu/rendutil.c index 5af4f57a2fa..c4bc491fa64 100644 --- a/src/emu/rendutil.c +++ b/src/emu/rendutil.c @@ -628,6 +628,59 @@ bitmap_t *render_load_png(emu_file &file, const char *dirname, const char *filen return bitmap; } +void render_load_png(bitmap_t &bitmap, emu_file &file, const char *dirname, const char *filename) +{ + png_info png; + png_error result; + + bitmap.deallocate(); + + /* open the file */ + astring fname; + if (dirname == NULL) + fname.cpy(filename); + else + fname.cpy(dirname).cat(PATH_SEPARATOR).cat(filename); + file_error filerr = file.open(fname); + if (filerr != FILERR_NONE) + return; + + /* read the PNG data */ + result = png_read_file(file, &png); + file.close(); + if (result != PNGERR_NONE) + return; + + /* verify we can handle this PNG */ + if (png.bit_depth > 8) + { + logerror("%s: Unsupported bit depth %d (8 bit max)\n", filename, png.bit_depth); + png_free(&png); + return; + } + if (png.interlace_method != 0) + { + logerror("%s: Interlace unsupported\n", filename); + png_free(&png); + return; + } + if (png.color_type != 0 && png.color_type != 3 && png.color_type != 2 && png.color_type != 6) + { + logerror("%s: Unsupported color type %d\n", filename, png.color_type); + png_free(&png); + return; + } + + /* if less than 8 bits, upsample */ + png_expand_buffer_8bit(&png); + + bitmap.allocate(png.width, png.height, BITMAP_FORMAT_ARGB32); + copy_png_to_bitmap(bitmap, &png, NULL); + + /* free PNG data */ + png_free(&png); +} + /*------------------------------------------------- copy_png_to_bitmap - copy the PNG data to a diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index 8e7b012f126..041748e0d23 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -29,6 +29,7 @@ int render_clip_line(render_bounds *bounds, const render_bounds *clip); int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); void render_line_to_quad(const render_bounds *bounds, float width, render_bounds *bounds0, render_bounds *bounds1); bitmap_t *render_load_png(emu_file &file, const char *dirname, const char *filename, bitmap_t *alphadest, bool *hasalpha); +void render_load_png(bitmap_t &bitmap, emu_file &file, const char *dirname, const char *filename); diff --git a/src/emu/screen.c b/src/emu/screen.c index 03141c1e1da..ef2803ad8b4 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -88,13 +88,11 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev m_container(NULL), m_width(100), m_height(100), - m_burnin(NULL), m_curbitmap(0), m_curtexture(0), m_texture_format(0), m_changed(true), m_last_partial_scan(0), - m_screen_overlay_bitmap(NULL), m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()), m_scantime(1), m_pixeltime(1), @@ -112,7 +110,6 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev m_visarea.max_x = m_width - 1; m_visarea.max_y = m_height - 1; memset(m_texture, 0, sizeof(m_texture)); - memset(m_bitmap, 0, sizeof(m_bitmap)); } @@ -352,10 +349,8 @@ void screen_device::device_start() int width, height; if (sscanf(machine().options().snap_size(), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) width = height = 300; - m_burnin = auto_alloc(machine(), bitmap_t(width, height, BITMAP_FORMAT_INDEXED64)); - if (m_burnin == NULL) - fatalerror("Error allocating burn-in bitmap for screen at (%dx%d)\n", width, height); - m_burnin->fill(0); + m_burnin.allocate(width, height, BITMAP_FORMAT_INDEXED64); + m_burnin.fill(0); } // load the effect overlay @@ -390,9 +385,8 @@ void screen_device::device_stop() { machine().render().texture_free(m_texture[0]); machine().render().texture_free(m_texture[1]); - if (m_burnin != NULL) + if (m_burnin.valid()) finalize_burnin(); - global_free(m_screen_overlay_bitmap); } @@ -495,13 +489,12 @@ void screen_device::realloc_screen_bitmaps() if (m_type == SCREEN_TYPE_VECTOR) return; - int curwidth = 0, curheight = 0; - // extract the current width/height from the bitmap - if (m_bitmap[0] != NULL) + int curwidth = 0, curheight = 0; + if (m_bitmap[0].valid()) { - curwidth = m_bitmap[0]->width(); - curheight = m_bitmap[0]->height(); + curwidth = m_bitmap[0].width(); + curheight = m_bitmap[0].height(); } // if we're too small to contain this width/height, reallocate our bitmaps and textures @@ -510,8 +503,6 @@ void screen_device::realloc_screen_bitmaps() // free what we have currently machine().render().texture_free(m_texture[0]); machine().render().texture_free(m_texture[1]); - auto_free(machine(), m_bitmap[0]); - auto_free(machine(), m_bitmap[1]); // compute new width/height curwidth = MAX(m_width, curwidth); @@ -528,16 +519,20 @@ void screen_device::realloc_screen_bitmaps() } // allocate bitmaps - m_bitmap[0] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_format)); - m_bitmap[0]->set_palette(machine().palette); - m_bitmap[1] = auto_alloc(machine(), bitmap_t(curwidth, curheight, m_format)); - m_bitmap[1]->set_palette(machine().palette); + m_bitmap[0].allocate(curwidth, curheight, m_format); + m_bitmap[0].set_palette(machine().palette); + m_bitmap[1].allocate(curwidth, curheight, m_format); + m_bitmap[1].set_palette(machine().palette); // allocate textures m_texture[0] = machine().render().texture_alloc(); - m_texture[0]->set_bitmap(m_bitmap[0], &m_visarea, m_texture_format, palette); + m_texture[0]->set_bitmap(&m_bitmap[0], &m_visarea, m_texture_format, palette); m_texture[1] = machine().render().texture_alloc(); - m_texture[1]->set_bitmap(m_bitmap[1], &m_visarea, m_texture_format, palette); + m_texture[1]->set_bitmap(&m_bitmap[1], &m_visarea, m_texture_format, palette); + + // allocate generic backing bitmap + m_default.allocate(curwidth, curheight, m_format); + m_default.set_palette(machine().palette); } } @@ -618,7 +613,7 @@ bool screen_device::update_partial(int scanline) g_profiler.start(PROFILER_VIDEO); LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); - flags = screen_update(*m_bitmap[m_curbitmap], clip); + flags = screen_update(m_bitmap[m_curbitmap], clip); m_partial_updates_this_frame++; g_profiler.stop(); @@ -876,7 +871,7 @@ bool screen_device::update_quads() fixedvis.max_y++; palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine().palette : NULL; - m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette); + m_texture[m_curbitmap]->set_bitmap(&m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette); m_curtexture = m_curbitmap; m_curbitmap = 1 - m_curbitmap; @@ -902,17 +897,17 @@ bool screen_device::update_quads() void screen_device::update_burnin() { #undef rand - if (m_burnin == NULL) + if (!m_burnin.valid()) return; - bitmap_t *srcbitmap = m_bitmap[m_curtexture]; - if (srcbitmap == NULL) + bitmap_t &srcbitmap = m_bitmap[m_curtexture]; + if (!srcbitmap.valid()) return; - int srcwidth = srcbitmap->width(); - int srcheight = srcbitmap->height(); - int dstwidth = m_burnin->width(); - int dstheight = m_burnin->height(); + int srcwidth = srcbitmap.width(); + int srcheight = srcbitmap.height(); + int dstwidth = m_burnin.width(); + int dstheight = m_burnin.height(); int xstep = (srcwidth << 16) / dstwidth; int ystep = (srcheight << 16) / dstheight; int xstart = ((UINT32)rand() % 32767) * xstep / 32767; @@ -923,12 +918,12 @@ void screen_device::update_burnin() // iterate over rows in the destination for (y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - UINT64 *dst = &m_burnin->pix64(y); + UINT64 *dst = &m_burnin.pix64(y); // handle the 16-bit palettized case - if (srcbitmap->format() == BITMAP_FORMAT_INDEXED16) + if (srcbitmap.format() == BITMAP_FORMAT_INDEXED16) { - const UINT16 *src = &srcbitmap->pix16(srcy >> 16); + const UINT16 *src = &srcbitmap.pix16(srcy >> 16); const rgb_t *palette = palette_entry_list_adjusted(machine().palette); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { @@ -938,9 +933,9 @@ void screen_device::update_burnin() } // handle the 15-bit RGB case - else if (srcbitmap->format() == BITMAP_FORMAT_RGB15) + else if (srcbitmap.format() == BITMAP_FORMAT_RGB15) { - const UINT16 *src = &srcbitmap->pix16(srcy >> 16); + const UINT16 *src = &srcbitmap.pix16(srcy >> 16); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb15_t pixel = src[srcx >> 16]; @@ -949,9 +944,9 @@ void screen_device::update_burnin() } // handle the 32-bit RGB case - else if (srcbitmap->format() == BITMAP_FORMAT_RGB32) + else if (srcbitmap.format() == BITMAP_FORMAT_RGB32) { - const UINT32 *src = &srcbitmap->pix32(srcy >> 16); + const UINT32 *src = &srcbitmap.pix32(srcy >> 16); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -968,20 +963,20 @@ void screen_device::update_burnin() void screen_device::finalize_burnin() { - if (m_burnin == NULL) + if (!m_burnin.valid()) return; // compute the scaled visible region rectangle scaledvis; - scaledvis.min_x = m_visarea.min_x * m_burnin->width() / m_width; - scaledvis.max_x = m_visarea.max_x * m_burnin->width() / m_width; - scaledvis.min_y = m_visarea.min_y * m_burnin->height() / m_height; - scaledvis.max_y = m_visarea.max_y * m_burnin->height() / m_height; + scaledvis.min_x = m_visarea.min_x * m_burnin.width() / m_width; + scaledvis.max_x = m_visarea.max_x * m_burnin.width() / m_width; + scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height; + scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height; // wrap a bitmap around the subregion we care about bitmap_t finalmap(scaledvis.max_x + 1 - scaledvis.min_x, scaledvis.max_y + 1 - scaledvis.min_y, BITMAP_FORMAT_ARGB32); - int srcwidth = m_burnin->width(); - int srcheight = m_burnin->height(); + int srcwidth = m_burnin.width(); + int srcheight = m_burnin.height(); int dstwidth = finalmap.width(); int dstheight = finalmap.height(); int xstep = (srcwidth << 16) / dstwidth; @@ -992,7 +987,7 @@ void screen_device::finalize_burnin() UINT64 maxval = 0; for (int y = 0; y < srcheight; y++) { - UINT64 *src = &m_burnin->pix64(y); + UINT64 *src = &m_burnin.pix64(y); for (int x = 0; x < srcwidth; x++) { minval = MIN(minval, src[x]); @@ -1006,7 +1001,7 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - UINT64 *src = &m_burnin->pix64(srcy >> 16); + UINT64 *src = &m_burnin.pix64(srcy >> 16); UINT32 *dst = &finalmap.pix32(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { @@ -1056,13 +1051,14 @@ void screen_device::load_effect_overlay(const char *filename) // load the file emu_file file(machine().options().art_path(), OPEN_FLAG_READ); - m_screen_overlay_bitmap = render_load_png(file, NULL, fullname, NULL, NULL); - if (m_screen_overlay_bitmap != NULL) - m_container->set_overlay(m_screen_overlay_bitmap); + render_load_png(m_screen_overlay_bitmap, file, NULL, fullname); + if (m_screen_overlay_bitmap.valid()) + m_container->set_overlay(&m_screen_overlay_bitmap); else mame_printf_warning("Unable to load effect PNG file '%s'\n", fullname.cstr()); } + //------------------------------------------------- // screen_update - default implementation which // calls to the legacy screen_update function @@ -1070,13 +1066,13 @@ void screen_device::load_effect_overlay(const char *filename) bool screen_device::screen_update(bitmap_t &bitmap, const rectangle &cliprect) { - if (m_screen_update != NULL) { + if (m_screen_update != NULL) return (*m_screen_update)(*this, bitmap, cliprect); - } else { + else return machine().driver_data<driver_device>()->screen_update(*this, bitmap, cliprect); - } } + //------------------------------------------------- // screen_eof - default implementation which // calls to the legacy screen_update function diff --git a/src/emu/screen.h b/src/emu/screen.h index 48109eb0062..16beda4af97 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -150,6 +150,7 @@ public: // additional helpers void register_vblank_callback(vblank_state_delegate vblank_callback); bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(machine(), (width == 0) ? m_width : width, (height == 0) ? m_height : height, format()); } + bitmap_t &default_bitmap() { return m_default; } // internal to the video system bool update_quads(); @@ -208,14 +209,15 @@ private: // textures and bitmaps render_texture * m_texture[2]; // 2x textures for the screen bitmap - bitmap_t * m_bitmap[2]; // 2x bitmaps for rendering - bitmap_t * m_burnin; // burn-in bitmap + bitmap_t m_bitmap[2]; // 2x bitmaps for rendering + bitmap_t m_default; // default backing bitmap (copied by default) + bitmap_t m_burnin; // burn-in bitmap UINT8 m_curbitmap; // current bitmap index UINT8 m_curtexture; // current texture index INT32 m_texture_format; // texture format of bitmap for this screen bool m_changed; // has this bitmap changed? INT32 m_last_partial_scan; // scanline of last partial update - bitmap_t * m_screen_overlay_bitmap; // screen overlay bitmap + bitmap_t m_screen_overlay_bitmap; // screen overlay bitmap // screen timing attoseconds_t m_frame_period; // attoseconds per frame diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index aefe85758cf..52f8f47c745 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -117,10 +117,10 @@ public: INT32 dy_flipped; /* global vertical scroll offset when flipped */ /* pixel data */ - bitmap_t * pixmap; /* cached pixel data */ + bitmap_t pixmap; /* cached pixel data */ /* transparency mapping */ - bitmap_t * flagsmap; /* per-pixel flags */ + bitmap_t flagsmap; /* per-pixel flags */ UINT8 * tileflags; /* per-tile flags */ UINT8 * pen_to_flags; /* mapping of pens to flags */ @@ -389,11 +389,11 @@ static tilemap_t *tilemap_create_common(running_machine &machine, void *get_info tmap->colscroll = auto_alloc_array_clear(machine, INT32, tmap->width); /* allocate the pixel data cache */ - tmap->pixmap = auto_bitmap_alloc(machine, tmap->width, tmap->height, BITMAP_FORMAT_INDEXED16); + tmap->pixmap.allocate(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED16); /* allocate transparency mapping data */ tmap->tileflags = auto_alloc_array(machine, UINT8, tmap->max_logical_index); - tmap->flagsmap = auto_bitmap_alloc(machine, tmap->width, tmap->height, BITMAP_FORMAT_INDEXED8); + tmap->flagsmap.allocate(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED8); tmap->pen_to_flags = auto_alloc_array_clear(machine, UINT8, MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); for (group = 0; group < TILEMAP_NUM_GROUPS; group++) tilemap_map_pens_to_layer(tmap, group, 0, 0, TILEMAP_PIXEL_LAYER0); @@ -780,7 +780,7 @@ bitmap_t &tilemap_get_pixmap(tilemap_t *tmap) { /* ensure all the tiles are up-to-date and then return the pixmap */ pixmap_update(tmap); - return *tmap->pixmap; + return tmap->pixmap; } @@ -793,7 +793,7 @@ bitmap_t &tilemap_get_flagsmap(tilemap_t *tmap) { /* ensure all the tiles are up-to-date and then return the flagsmap */ pixmap_update(tmap); - return *tmap->flagsmap; + return tmap->flagsmap; } @@ -1171,8 +1171,6 @@ static void tilemap_dispose(tilemap_t *tmap) /* free allocated memory */ auto_free(tmap->machine(), tmap->pen_to_flags); auto_free(tmap->machine(), tmap->tileflags); - auto_free(tmap->machine(), tmap->flagsmap); - auto_free(tmap->machine(), tmap->pixmap); auto_free(tmap->machine(), tmap->colscroll); auto_free(tmap->machine(), tmap->rowscroll); auto_free(tmap->machine(), tmap->logical_to_memory); @@ -1361,8 +1359,8 @@ g_profiler.stop(); static UINT8 tile_draw(tilemap_t *tmap, const UINT8 *pendata, UINT32 x0, UINT32 y0, UINT32 palette_base, UINT8 category, UINT8 group, UINT8 flags, UINT8 pen_mask) { const UINT8 *penmap = tmap->pen_to_flags + group * MAX_PEN_TO_FLAGS; - bitmap_t *flagsmap = tmap->flagsmap; - bitmap_t *pixmap = tmap->pixmap; + bitmap_t &flagsmap = tmap->flagsmap; + bitmap_t &pixmap = tmap->pixmap; int height = tmap->tileheight; int width = tmap->tilewidth; UINT8 andmask = ~0, ormask = 0; @@ -1396,8 +1394,8 @@ static UINT8 tile_draw(tilemap_t *tmap, const UINT8 *pendata, UINT32 x0, UINT32 /* iterate over rows */ for (ty = 0; ty < height; ty++) { - UINT16 *pixptr = &pixmap->pix16(y0, x0); - UINT8 *flagsptr = &flagsmap->pix8(y0, x0); + UINT16 *pixptr = &pixmap.pix16(y0, x0); + UINT8 *flagsptr = &flagsmap.pix8(y0, x0); int xoffs = 0; /* pre-advance to the next row */ @@ -1456,7 +1454,7 @@ static UINT8 tile_draw(tilemap_t *tmap, const UINT8 *pendata, UINT32 x0, UINT32 static UINT8 tile_apply_bitmask(tilemap_t *tmap, const UINT8 *maskdata, UINT32 x0, UINT32 y0, UINT8 category, UINT8 flags) { - bitmap_t *flagsmap = tmap->flagsmap; + bitmap_t &flagsmap = tmap->flagsmap; int height = tmap->tileheight; int width = tmap->tilewidth; UINT8 andmask = ~0, ormask = 0; @@ -1481,7 +1479,7 @@ static UINT8 tile_apply_bitmask(tilemap_t *tmap, const UINT8 *maskdata, UINT32 x /* iterate over rows */ for (ty = 0; ty < height; ty++) { - UINT8 *flagsptr = &flagsmap->pix8(y0, x0); + UINT8 *flagsptr = &flagsmap.pix8(y0, x0); int xoffs = 0; /* pre-advance to the next row */ @@ -1637,8 +1635,8 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, y2 -= ypos; /* get tilemap pixels */ - source_baseaddr = &tmap->pixmap->pix16(y1); - mask_baseaddr = &tmap->flagsmap->pix8(y1); + source_baseaddr = &tmap->pixmap.pix16(y1); + mask_baseaddr = &tmap->flagsmap.pix8(y1); /* get start/stop columns, rounding outward */ mincol = x1 / tmap->tilewidth; @@ -1710,7 +1708,7 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, (*blit->draw_opaque)(dest0, source0, x_end - x_start, tmap->machine().pens, pmap0, blit->tilemap_priority_code, blit->alpha); dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; - source0 += tmap->pixmap->rowpixels(); + source0 += tmap->pixmap.rowpixels(); pmap0 += priority_bitmap.rowpixels(); } } @@ -1724,8 +1722,8 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, (*blit->draw_masked)(dest0, source0, mask0, blit->mask, blit->value, x_end - x_start, tmap->machine().pens, pmap0, blit->tilemap_priority_code, blit->alpha); dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; - source0 += tmap->pixmap->rowpixels(); - mask0 += tmap->flagsmap->rowpixels(); + source0 += tmap->pixmap.rowpixels(); + mask0 += tmap->flagsmap.rowpixels(); pmap0 += priority_bitmap.rowpixels(); } } @@ -1742,8 +1740,8 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, /* advance to the next row on all our bitmaps */ priority_baseaddr += priority_bitmap.rowpixels() * (nexty - y); - source_baseaddr += tmap->pixmap->rowpixels() * (nexty - y); - mask_baseaddr += tmap->flagsmap->rowpixels() * (nexty - y); + source_baseaddr += tmap->pixmap.rowpixels() * (nexty - y); + mask_baseaddr += tmap->flagsmap.rowpixels() * (nexty - y); dest_baseaddr = (UINT8 *)dest_baseaddr + dest_line_pitch_bytes * (nexty - y); /* increment the Y counter */ @@ -1780,8 +1778,8 @@ static void tilemap_draw_roz_core(tilemap_t *tmap, const blit_parameters *blit, const pen_t *clut = &tmap->machine().pens[blit->tilemap_priority_code >> 16]; bitmap_t &priority_bitmap = tmap->machine().priority_bitmap; bitmap_t &destbitmap = *blit->bitmap; - bitmap_t &srcbitmap = *tmap->pixmap; - bitmap_t &flagsmap = *tmap->flagsmap; + bitmap_t &srcbitmap = tmap->pixmap; + bitmap_t &flagsmap = tmap->flagsmap; const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; diff --git a/src/emu/video.c b/src/emu/video.c index 94156a71c7f..d6e97e09188 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -124,7 +124,6 @@ video_manager::video_manager(running_machine &machine) m_skipping_this_frame(false), m_average_oversleep(0), m_snap_target(NULL), - m_snap_bitmap(NULL), m_snap_native(true), m_snap_width(0), m_snap_height(0), @@ -345,7 +344,7 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) // now do the actual work const rgb_t *palette = (machine().palette != NULL) ? palette_entry_list_adjusted(machine().palette) : NULL; - png_error error = png_write_bitmap(file, &pnginfo, *m_snap_bitmap, machine().total_colors(), palette); + png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, machine().total_colors(), palette); if (error != PNGERR_NONE) mame_printf_error("Error generating PNG for snapshot: png_error = %d\n", error); @@ -411,8 +410,8 @@ void video_manager::begin_recording(const char *name, movie_format format) info.video_timescale = 1000 * ((machine().primary_screen != NULL) ? ATTOSECONDS_TO_HZ(machine().primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE); info.video_sampletime = 1000; info.video_numsamples = 0; - info.video_width = m_snap_bitmap->width(); - info.video_height = m_snap_bitmap->height(); + info.video_width = m_snap_bitmap.width(); + info.video_height = m_snap_bitmap.height(); info.video_depth = 24; info.audio_format = 0; @@ -465,7 +464,7 @@ void video_manager::begin_recording(const char *name, movie_format format) { // start the capture int rate = (machine().primary_screen != NULL) ? ATTOSECONDS_TO_HZ(machine().primary_screen->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE; - png_error pngerr = mng_capture_start(*m_mngfile, *m_snap_bitmap, rate); + png_error pngerr = mng_capture_start(*m_mngfile, m_snap_bitmap, rate); if (pngerr != PNGERR_NONE) return end_recording(); @@ -548,8 +547,7 @@ void video_manager::exit() // free the snapshot target machine().render().target_free(m_snap_target); - if (m_snap_bitmap != NULL) - global_free(m_snap_bitmap); + m_snap_bitmap.deallocate(); // print a final result if we have at least 5 seconds' worth of data if (m_overall_emutime.seconds >= 5) @@ -1076,17 +1074,13 @@ void video_manager::create_snapshot_bitmap(device_t *screen) m_snap_target->set_bounds(width, height); // if we don't have a bitmap, or if it's not the right size, allocate a new one - if (m_snap_bitmap == NULL || width != m_snap_bitmap->width() || height != m_snap_bitmap->height()) - { - if (m_snap_bitmap != NULL) - auto_free(machine(), m_snap_bitmap); - m_snap_bitmap = auto_alloc(machine(), bitmap_t(width, height, BITMAP_FORMAT_RGB32)); - } + if (!m_snap_bitmap.valid() || width != m_snap_bitmap.width() || height != m_snap_bitmap.height()) + m_snap_bitmap.allocate(width, height, BITMAP_FORMAT_RGB32); // render the screen there render_primitive_list &primlist = m_snap_target->get_primitives(); primlist.acquire_lock(); - rgb888_draw_primitives(primlist, &m_snap_bitmap->pix32(0), width, height, m_snap_bitmap->rowpixels()); + rgb888_draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); primlist.release_lock(); } @@ -1244,7 +1238,7 @@ void video_manager::record_frame() if (m_avifile != NULL) { // write the next frame - avi_error avierr = avi_append_video_frame_rgb32(m_avifile, *m_snap_bitmap); + avi_error avierr = avi_append_video_frame_rgb32(m_avifile, m_snap_bitmap); if (avierr != AVIERR_NONE) { g_profiler.stop(); @@ -1267,7 +1261,7 @@ void video_manager::record_frame() // write the next frame const rgb_t *palette = (machine().palette != NULL) ? palette_entry_list_adjusted(machine().palette) : NULL; - png_error error = mng_capture_frame(*m_mngfile, &pnginfo, *m_snap_bitmap, machine().total_colors(), palette); + png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, machine().total_colors(), palette); png_free(&pnginfo); if (error != PNGERR_NONE) { diff --git a/src/emu/video.h b/src/emu/video.h index c61cf286e88..4abe5799c27 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -181,7 +181,7 @@ private: // snapshot stuff render_target * m_snap_target; // screen shapshot target - bitmap_t * m_snap_bitmap; // screen snapshot bitmap + bitmap_t m_snap_bitmap; // screen snapshot bitmap bool m_snap_native; // are we using native per-screen layouts? INT32 m_snap_width; // width of snapshots (0 == auto) INT32 m_snap_height; // height of snapshots (0 == auto) diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index 3c8315fca19..7d8adb1fc39 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -262,38 +262,6 @@ void generic_video_init(running_machine &machine) /*************************************************************************** - GENERIC VIDEO START/UPDATE -***************************************************************************/ - -/*------------------------------------------------- - VIDEO_START( generic_bitmapped ) - general video - system with a bitmap --------------------------------------------------*/ - -VIDEO_START( generic_bitmapped ) -{ - /* allocate the temporary bitmap */ - machine.generic.tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); - - /* ensure the contents of the bitmap are saved */ - machine.save().save_item(NAME(*machine.generic.tmpbitmap)); -} - - -/*------------------------------------------------- - SCREEN_UPDATE( generic_bitmapped ) - blast the - generic bitmap to the screen --------------------------------------------------*/ - -SCREEN_UPDATE( generic_bitmapped ) -{ - copybitmap(bitmap, *screen.machine().generic.tmpbitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - - -/*************************************************************************** GENERIC SPRITE BUFFERING ***************************************************************************/ diff --git a/src/emu/video/generic.h b/src/emu/video/generic.h index 9ed617608d8..1accc6085c4 100644 --- a/src/emu/video/generic.h +++ b/src/emu/video/generic.h @@ -40,12 +40,6 @@ extern const gfx_layout gfx_16x16x4_planar; /* set up all the common systems */ void generic_video_init(running_machine &machine); -/* generic video start with a temporary bitmap */ -VIDEO_START( generic_bitmapped ); - -/* generic video update to blit a temporary bitmap */ -SCREEN_UPDATE( generic_bitmapped ); - /* ----- sprite buffering ----- */ diff --git a/src/mame/drivers/3do.c b/src/mame/drivers/3do.c index 3a8917a6806..d5105b444f1 100644 --- a/src/mame/drivers/3do.c +++ b/src/mame/drivers/3do.c @@ -163,13 +163,11 @@ static MACHINE_CONFIG_START( 3do, _3do_state ) MCFG_MACHINE_RESET( 3do ) -// MCFG_VIDEO_START( generic_bitmapped ) MCFG_VIDEO_START( _3do ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_FORMAT( BITMAP_FORMAT_RGB32 ) MCFG_SCREEN_RAW_PARAMS( X2_CLOCK_NTSC / 2, 1592, 254, 1534, 263, 22, 262 ) -// MCFG_SCREEN_UPDATE( generic_bitmapped ) MCFG_SCREEN_UPDATE( _3do ) MCFG_CDROM_ADD( "cdrom", _3do_cdrom) @@ -184,14 +182,11 @@ static MACHINE_CONFIG_START( 3do_pal, _3do_state ) MCFG_MACHINE_RESET( 3do ) - MCFG_VIDEO_START( generic_bitmapped ) - MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_FORMAT( BITMAP_FORMAT_RGB32 ) MCFG_SCREEN_SIZE( 640, 625 ) MCFG_SCREEN_VISIBLE_AREA( 0, 639, 0, 479 ) MCFG_SCREEN_REFRESH_RATE( 50 ) - MCFG_SCREEN_UPDATE( generic_bitmapped ) MCFG_CDROM_ADD( "cdrom", _3do_cdrom) MACHINE_CONFIG_END diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index 02c5ba00555..e8b3da816f8 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -162,7 +162,6 @@ public: required_device<h63484_device> m_h63484; - virtual void video_start(); virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); /* misc */ @@ -175,11 +174,6 @@ public: device_t *m_duart; }; -void adp_state::video_start() -{ - VIDEO_START_NAME(generic_bitmapped)(machine()); -} - static H63484_DISPLAY_PIXELS( acrtc_display_pixels ) { @@ -679,7 +673,6 @@ static MACHINE_CONFIG_START( quickjac, adp_state ) MCFG_PALETTE_LENGTH(0x10) MCFG_PALETTE_INIT(adp) -// MCFG_VIDEO_START(adp) MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map) @@ -712,7 +705,6 @@ static MACHINE_CONFIG_START( skattv, adp_state ) MCFG_PALETTE_LENGTH(0x10) MCFG_PALETTE_INIT(adp) -// MCFG_VIDEO_START(adp) MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map) @@ -744,7 +736,6 @@ static MACHINE_CONFIG_START( backgamn, adp_state ) MCFG_PALETTE_LENGTH(0x10) // MCFG_PALETTE_INIT(adp) -// MCFG_VIDEO_START(adp) MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map) diff --git a/src/mame/drivers/big10.c b/src/mame/drivers/big10.c index cf33cb407f0..417ca4e5182 100644 --- a/src/mame/drivers/big10.c +++ b/src/mame/drivers/big10.c @@ -93,8 +93,7 @@ static TIMER_DEVICE_CALLBACK( big10_interrupt ) static VIDEO_START( big10 ) { - VIDEO_START_CALL(generic_bitmapped); - v9938_init (machine, 0, *machine.primary_screen, *machine.generic.tmpbitmap, MODEL_V9938, VDP_MEM, big10_vdp_interrupt); + v9938_init (machine, 0, *machine.primary_screen, machine.primary_screen->default_bitmap(), MODEL_V9938, VDP_MEM, big10_vdp_interrupt); v9938_reset(0); } @@ -268,7 +267,6 @@ static MACHINE_CONFIG_START( big10, big10_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(512 + 32, (212 + 28) * 2) MCFG_SCREEN_VISIBLE_AREA(0, 512 + 32 - 1, 0, (212 + 28) * 2 - 1) - MCFG_SCREEN_UPDATE(generic_bitmapped) MCFG_PALETTE_LENGTH(512) MCFG_PALETTE_INIT(v9938) diff --git a/src/mame/drivers/gei.c b/src/mame/drivers/gei.c index 081058bce2a..f984e5fe116 100644 --- a/src/mame/drivers/gei.c +++ b/src/mame/drivers/gei.c @@ -116,7 +116,7 @@ static WRITE8_HANDLER( gei_bitmap_w ) for (i = 0; i < 8; i++) - space->machine().generic.tmpbitmap->pix16(sy, sx+i) = state->m_color[8-i-1]; + space->machine().primary_screen->default_bitmap().pix16(sy, sx+i) = state->m_color[8-i-1]; } static PALETTE_INIT(gei) @@ -1087,15 +1087,12 @@ static MACHINE_CONFIG_START( getrivia, gei_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(512, 256) MCFG_SCREEN_VISIBLE_AREA(48, 511-48, 16, 255-16) - MCFG_SCREEN_UPDATE(generic_bitmapped) MCFG_PALETTE_LENGTH(8) MCFG_PALETTE_INIT(gei) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_VIDEO_START(generic_bitmapped) - MCFG_PPI8255_ADD( "ppi8255_0", getrivia_ppi8255_intf[0] ) MCFG_PPI8255_ADD( "ppi8255_1", getrivia_ppi8255_intf[1] ) MCFG_TICKET_DISPENSER_ADD("ticket", 100, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH) diff --git a/src/mame/drivers/kas89.c b/src/mame/drivers/kas89.c index 4f3b05a7a9d..35d997016e8 100644 --- a/src/mame/drivers/kas89.c +++ b/src/mame/drivers/kas89.c @@ -241,8 +241,7 @@ static TIMER_DEVICE_CALLBACK( kas89_interrupt ) static VIDEO_START( kas89 ) { - VIDEO_START_CALL(generic_bitmapped); - v9938_init (machine, 0, *machine.primary_screen, *machine.generic.tmpbitmap, MODEL_V9938, VDP_MEM, kas89_vdp_interrupt); + v9938_init (machine, 0, *machine.primary_screen, machine.primary_screen->default_bitmap(), MODEL_V9938, VDP_MEM, kas89_vdp_interrupt); v9938_reset(0); } @@ -802,7 +801,6 @@ static MACHINE_CONFIG_START( kas89, kas89_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(544, 524) MCFG_SCREEN_VISIBLE_AREA(0, 544 - 1, 0, 480 - 1) - MCFG_SCREEN_UPDATE(generic_bitmapped) MCFG_PALETTE_LENGTH(512) MCFG_PALETTE_INIT(v9938) diff --git a/src/mame/drivers/sangho.c b/src/mame/drivers/sangho.c index 97941ac4106..dded8d6dbcb 100644 --- a/src/mame/drivers/sangho.c +++ b/src/mame/drivers/sangho.c @@ -368,8 +368,7 @@ static TIMER_DEVICE_CALLBACK( sangho_interrupt ) static VIDEO_START( sangho ) { - VIDEO_START_CALL(generic_bitmapped); - v9938_init (machine, 0, *machine.primary_screen, *machine.generic.tmpbitmap, MODEL_V9938, 0x20000, msx_vdp_interrupt); + v9938_init (machine, 0, *machine.primary_screen, machine.primary_screen->default_bitmap(), MODEL_V9938, 0x20000, msx_vdp_interrupt); } static MACHINE_CONFIG_START( pzlestar, sangho_state ) @@ -387,7 +386,6 @@ static MACHINE_CONFIG_START( pzlestar, sangho_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(512 + 32, (212 + 28) * 2) MCFG_SCREEN_VISIBLE_AREA(0, 512 + 32 - 1, 0, (212 + 28) * 2 - 1) - MCFG_SCREEN_UPDATE( generic_bitmapped ) MCFG_PALETTE_LENGTH(512) @@ -420,7 +418,6 @@ static MACHINE_CONFIG_START( sexyboom, sangho_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(512 + 32, (212 + 28) * 2) MCFG_SCREEN_VISIBLE_AREA(0, 512 + 32 - 1, 0, (212 + 28) * 2 - 1) - MCFG_SCREEN_UPDATE( generic_bitmapped ) MCFG_PALETTE_LENGTH(512) diff --git a/src/mame/drivers/sfkick.c b/src/mame/drivers/sfkick.c index 0109d5de765..bb6a9335cde 100644 --- a/src/mame/drivers/sfkick.c +++ b/src/mame/drivers/sfkick.c @@ -436,8 +436,7 @@ static void sfkick_vdp_interrupt(running_machine &machine, int i) static VIDEO_START( sfkick ) { - VIDEO_START_CALL(generic_bitmapped); - v9938_init (machine, 0, *machine.primary_screen, *machine.generic.tmpbitmap, MODEL_V9938, 0x80000, sfkick_vdp_interrupt); + v9938_init (machine, 0, *machine.primary_screen, machine.primary_screen->default_bitmap(), MODEL_V9938, 0x80000, sfkick_vdp_interrupt); v9938_reset(0); } @@ -496,7 +495,6 @@ static MACHINE_CONFIG_START( sfkick, sfkick_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, MSX2_TOTAL_YRES_PIXELS) MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1) - MCFG_SCREEN_UPDATE(generic_bitmapped) MCFG_PALETTE_LENGTH(512) diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c index 56b10f9677a..a987453b48d 100644 --- a/src/mame/drivers/sothello.c +++ b/src/mame/drivers/sothello.c @@ -338,8 +338,7 @@ static const msm5205_interface msm_interface = static VIDEO_START( sothello ) { - VIDEO_START_CALL(generic_bitmapped); - v9938_init (machine, 0, *machine.primary_screen, *machine.generic.tmpbitmap, MODEL_V9938, VDP_MEM, sothello_vdp_interrupt); + v9938_init (machine, 0, *machine.primary_screen, machine.primary_screen->default_bitmap(), MODEL_V9938, VDP_MEM, sothello_vdp_interrupt); v9938_reset(0); } @@ -387,7 +386,6 @@ static MACHINE_CONFIG_START( sothello, sothello_state ) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(512 + 32, (212 + 28) * 2) MCFG_SCREEN_VISIBLE_AREA(0, 512 + 32 - 1, 0, (212 + 28) * 2 - 1) - MCFG_SCREEN_UPDATE(generic_bitmapped) MCFG_PALETTE_LENGTH(512) MCFG_PALETTE_INIT( v9938 ) diff --git a/src/mame/includes/naughtyb.h b/src/mame/includes/naughtyb.h index c8877a5206e..91d7d99d7d1 100644 --- a/src/mame/includes/naughtyb.h +++ b/src/mame/includes/naughtyb.h @@ -14,6 +14,7 @@ public: int m_cocktail; UINT8 m_palreg; int m_bankreg; + bitmap_t m_tmpbitmap; }; diff --git a/src/mame/includes/tunhunt.h b/src/mame/includes/tunhunt.h index 6b0e97f1fb2..d110aee9551 100644 --- a/src/mame/includes/tunhunt.h +++ b/src/mame/includes/tunhunt.h @@ -9,6 +9,7 @@ public: UINT8 *m_spriteram; UINT8 *m_videoram; tilemap_t *m_fg_tilemap; + bitmap_t m_tmpbitmap; }; diff --git a/src/mame/video/atari.c b/src/mame/video/atari.c index 17a07ea18f8..713188f01ac 100644 --- a/src/mame/video/atari.c +++ b/src/mame/video/atari.c @@ -759,8 +759,6 @@ VIDEO_START( atari ) { antic.video[i] = auto_alloc_clear(machine, VIDEO); } - - VIDEO_START_CALL(generic_bitmapped); } /************************************************************************ @@ -772,7 +770,7 @@ SCREEN_UPDATE( atari ) { UINT32 new_tv_artifacts; - SCREEN_UPDATE_CALL(generic_bitmapped); + copybitmap(bitmap, screen.default_bitmap(), 0, 0, 0, 0, cliprect); new_tv_artifacts = input_port_read_safe(screen.machine(), "artifacts", 0); if( tv_artifacts != new_tv_artifacts ) @@ -1043,7 +1041,7 @@ static void antic_linerefresh(running_machine &machine) dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; - draw_scanline8(*machine.generic.tmpbitmap, 12, y, MIN(machine.generic.tmpbitmap->width() - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL); + draw_scanline8(machine.primary_screen->default_bitmap(), 12, y, MIN(machine.primary_screen->default_bitmap().width() - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL); } static int cycle(running_machine &machine) diff --git a/src/mame/video/galpanic.c b/src/mame/video/galpanic.c index 06f923e96f9..e8b0334b306 100644 --- a/src/mame/video/galpanic.c +++ b/src/mame/video/galpanic.c @@ -6,7 +6,6 @@ VIDEO_START( galpanic ) { galpanic_state *state = machine.driver_data<galpanic_state>(); - machine.generic.tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); state->m_sprites_bitmap = machine.primary_screen->alloc_compatible_bitmap(); } @@ -34,7 +33,7 @@ WRITE16_HANDLER( galpanic_bgvideoram_w ) sy = offset / 256; sx = offset % 256; - space->machine().generic.tmpbitmap->pix16(sy, sx) = 1024 + (data >> 1); + space->machine().primary_screen->default_bitmap().pix16(sy, sx) = 1024 + (data >> 1); } WRITE16_HANDLER( galpanic_paletteram_w ) @@ -105,7 +104,7 @@ SCREEN_UPDATE( galpanic ) device_t *pandora = screen.machine().device("pandora"); /* copy the temporary bitmap to the screen */ - copybitmap(bitmap,*screen.machine().generic.tmpbitmap,0,0,0,0,cliprect); + copybitmap(bitmap,screen.default_bitmap(),0,0,0,0,cliprect); draw_fgbitmap(screen.machine(), bitmap, cliprect); @@ -118,7 +117,7 @@ SCREEN_UPDATE( comad ) { galpanic_state *state = screen.machine().driver_data<galpanic_state>(); /* copy the temporary bitmap to the screen */ - copybitmap(bitmap,*screen.machine().generic.tmpbitmap,0,0,0,0,cliprect); + copybitmap(bitmap,screen.default_bitmap(),0,0,0,0,cliprect); draw_fgbitmap(screen.machine(), bitmap, cliprect); diff --git a/src/mame/video/magmax.c b/src/mame/video/magmax.c index 2e25232b47a..a58c585f1ba 100644 --- a/src/mame/video/magmax.c +++ b/src/mame/video/magmax.c @@ -73,8 +73,6 @@ VIDEO_START( magmax ) state->m_prom_tab = auto_alloc_array(machine, UINT32, 256); /* Allocate temporary bitmap */ - machine.generic.tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); - for (i=0; i<256; i++) { v = (prom14D[i] << 4) + prom14D[i + 0x100]; @@ -105,7 +103,7 @@ SCREEN_UPDATE( magmax ) UINT32 scroll_v = (*state->m_scroll_y) & 0xff; /*clear background-over-sprites bitmap*/ - screen.machine().generic.tmpbitmap->fill(0); + screen.default_bitmap().fill(0); for (v = 2*8; v < 30*8; v++) /*only for visible area*/ { @@ -156,7 +154,7 @@ SCREEN_UPDATE( magmax ) /*priority: background over sprites*/ if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c)) - screen.machine().generic.tmpbitmap->pix16(v, h) = line_data[h]; + screen.default_bitmap().pix16(v, h) = line_data[h]; } if (state->m_flipscreen) @@ -211,7 +209,7 @@ SCREEN_UPDATE( magmax ) } if (!(*state->m_vreg & 0x40)) /* background disable */ - copybitmap_trans(bitmap, *screen.machine().generic.tmpbitmap, state->m_flipscreen,state->m_flipscreen,0,0, cliprect, 0); + copybitmap_trans(bitmap, screen.default_bitmap(), state->m_flipscreen,state->m_flipscreen,0,0, cliprect, 0); /* draw the foreground characters */ for (offs = 32*32-1; offs >= 0; offs -= 1) diff --git a/src/mame/video/mcd212.c b/src/mame/video/mcd212.c index a4bd1b747cf..d7071574c40 100644 --- a/src/mame/video/mcd212.c +++ b/src/mame/video/mcd212.c @@ -1332,7 +1332,7 @@ static void mcd212_draw_cursor(mcd212_regs_t *mcd212, UINT32 *scanline, int y) static void mcd212_draw_scanline(mcd212_regs_t *mcd212, int y) { running_machine &machine = mcd212->machine(); - bitmap_t &bitmap = *machine.generic.tmpbitmap; + bitmap_t &bitmap = machine.primary_screen->default_bitmap(); UINT8 plane_a_r[768], plane_a_g[768], plane_a_b[768]; UINT8 plane_b_r[768], plane_b_g[768], plane_b_b[768]; UINT32 out[768]; @@ -1652,7 +1652,6 @@ VIDEO_START( cdimono1 ) { cdi_state *state = machine.driver_data<cdi_state>(); - VIDEO_START_CALL(generic_bitmapped); mcd212_ab_init(&state->m_mcd212_ab); mcd212_init(machine, &state->m_mcd212_regs); state->m_mcd212_regs.scan_timer = machine.scheduler().timer_alloc(FUNC(mcd212_perform_scan)); @@ -1663,7 +1662,7 @@ VIDEO_START( cdimono1 ) SCREEN_UPDATE( cdimono1 ) { - copybitmap(bitmap, *screen.machine().generic.tmpbitmap, 0, 0, 0, 0, cliprect); + copybitmap(bitmap, screen.default_bitmap(), 0, 0, 0, 0, cliprect); return 0; } diff --git a/src/mame/video/naughtyb.c b/src/mame/video/naughtyb.c index 1e065f58b6e..8a4a679b40e 100644 --- a/src/mame/video/naughtyb.c +++ b/src/mame/video/naughtyb.c @@ -104,7 +104,7 @@ VIDEO_START( naughtyb ) state->m_palreg = state->m_bankreg = 0; /* Naughty Boy has a virtual screen twice as large as the visible screen */ - machine.generic.tmpbitmap = auto_bitmap_alloc(machine,68*8,28*8,machine.primary_screen->format()); + state->m_tmpbitmap.allocate(68*8,28*8,machine.primary_screen->format()); } @@ -190,7 +190,7 @@ SCREEN_UPDATE( naughtyb ) naughtyb_state *state = screen.machine().driver_data<naughtyb_state>(); UINT8 *videoram = state->m_videoram; - bitmap_t &tmpbitmap = *screen.machine().generic.tmpbitmap; + bitmap_t &tmpbitmap = state->m_tmpbitmap; int offs; // for every character in the Video RAM diff --git a/src/mame/video/tunhunt.c b/src/mame/video/tunhunt.c index d9ff0ff5622..d52542ec822 100644 --- a/src/mame/video/tunhunt.c +++ b/src/mame/video/tunhunt.c @@ -76,7 +76,7 @@ VIDEO_START( tunhunt ) */ tunhunt_state *state = machine.driver_data<tunhunt_state>(); - machine.generic.tmpbitmap = auto_bitmap_alloc(machine, 256, 64, machine.primary_screen->format()); + state->m_tmpbitmap.allocate(256, 64, machine.primary_screen->format()); state->m_fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32); @@ -214,7 +214,7 @@ static void draw_motion_object(running_machine &machine, bitmap_t &bitmap, const */ tunhunt_state *state = machine.driver_data<tunhunt_state>(); - bitmap_t &tmpbitmap = *machine.generic.tmpbitmap; + bitmap_t &tmpbitmap = state->m_tmpbitmap; UINT8 *spriteram = state->m_spriteram; UINT8 *tunhunt_ram = state->m_workram; //int skip = tunhunt_ram[MOBST]; diff --git a/src/mame/video/zac2650.c b/src/mame/video/zac2650.c index 0f0eed5d28e..6606d2052c8 100644 --- a/src/mame/video/zac2650.c +++ b/src/mame/video/zac2650.c @@ -145,7 +145,6 @@ VIDEO_START( tinvader ) 24, 24, 32, 32); state->m_spritebitmap = machine.primary_screen->alloc_compatible_bitmap(); - machine.generic.tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); gfx_element_set_source(machine.gfx[1], state->m_s2636_0_ram); gfx_element_set_source(machine.gfx[2], state->m_s2636_0_ram); @@ -171,7 +170,7 @@ static void draw_sprites(running_machine &machine, bitmap_t &bitmap, const recta state->m_CollisionBackground = 0; /* Read from 0x1e80 bit 7 */ // for collision detection checking - copybitmap(*machine.generic.tmpbitmap,bitmap,0,0,0,0,visarea); + copybitmap(machine.primary_screen->default_bitmap(),bitmap,0,0,0,0,visarea); for(offs=0;offs<0x50;offs+=0x10) { @@ -202,7 +201,7 @@ static void draw_sprites(running_machine &machine, bitmap_t &bitmap, const recta continue; } - if (bitmap.pix16(y, x) != machine.generic.tmpbitmap->pix16(y, x)) + if (bitmap.pix16(y, x) != machine.primary_screen->default_bitmap().pix16(y, x)) { state->m_CollisionBackground = 0x80; break; |