diff options
Diffstat (limited to 'src/emu/tilemap.cpp')
-rw-r--r-- | src/emu/tilemap.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 5757f35341f..1aa18eef168 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -772,7 +772,7 @@ void tilemap_t::pixmap_update() if (m_all_tiles_clean) return; -g_profiler.start(PROFILER_TILEMAP_DRAW); + auto profile = g_profiler.start(PROFILER_TILEMAP_DRAW); // flush the dirty state to all tiles as appropriate realize_all_dirty_tiles(); @@ -786,8 +786,6 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // mark it all clean m_all_tiles_clean = true; - -g_profiler.stop(); } @@ -797,7 +795,7 @@ g_profiler.stop(); void tilemap_t::tile_update(logical_index logindex, u32 col, u32 row) { -g_profiler.start(PROFILER_TILEMAP_UPDATE); + auto profile = g_profiler.start(PROFILER_TILEMAP_UPDATE); // call the get info callback for the associated memory index tilemap_memory_index memindex = m_logical_to_memory[logindex]; @@ -822,8 +820,6 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE); m_gfx_used |= 1 << m_tileinfo.gfxnum; m_gfx_dirtyseq[m_tileinfo.gfxnum] = m_tileinfo.decoder->gfx(m_tileinfo.gfxnum)->dirtyseq(); } - -g_profiler.stop(); } @@ -997,7 +993,8 @@ void tilemap_t::draw_common(screen_device &screen, _BitmapClass &dest, const rec if (!m_enable) return; -g_profiler.start(PROFILER_TILEMAP_DRAW); + auto profile = g_profiler.start(PROFILER_TILEMAP_DRAW); + // configure the blit parameters based on the input parameters blit_parameters blit; configure_blit_parameters(blit, screen.priority(), cliprect, flags, priority, priority_mask); @@ -1095,7 +1092,6 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); } } } -g_profiler.stop(); } void tilemap_t::draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask) @@ -1134,7 +1130,8 @@ void tilemap_t::draw_roz_common(screen_device &screen, _BitmapClass &dest, const return; } -g_profiler.start(PROFILER_TILEMAP_DRAW_ROZ); + auto profile = g_profiler.start(PROFILER_TILEMAP_DRAW_ROZ); + // configure the blit parameters blit_parameters blit; configure_blit_parameters(blit, screen.priority(), cliprect, flags, priority, priority_mask); @@ -1146,7 +1143,6 @@ g_profiler.start(PROFILER_TILEMAP_DRAW_ROZ); // then do the roz copy draw_roz_core(screen, dest, blit, startx, starty, incxx, incxy, incyx, incyy, wraparound); -g_profiler.stop(); } void tilemap_t::draw_roz(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, @@ -1182,7 +1178,16 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - u8 *priority_baseaddr = &priority_bitmap.pix(y1, xpos); + u8 *priority_baseaddr = nullptr; + int prio_rowpixels = 0; + if (priority_bitmap.valid()) + { + prio_rowpixels = priority_bitmap.rowpixels(); + priority_baseaddr = &priority_bitmap.pix(y1, xpos); + } + else + assert((blit.tilemap_priority_code & 0xffff) == 0xff00); + typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1260,7 +1265,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b { const u16 *source0 = source_baseaddr + x_start; typename _BitmapClass::pixel_t *dest0 = dest_baseaddr + x_start; - u8 *pmap0 = priority_baseaddr + x_start; + u8 *pmap0 = priority_baseaddr ? (priority_baseaddr + x_start) : nullptr; // if we were opaque, use the opaque renderer if (prev_trans == WHOLLY_OPAQUE) @@ -1278,7 +1283,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b dest0 += dest_rowpixels; source0 += m_pixmap.rowpixels(); - pmap0 += priority_bitmap.rowpixels(); + pmap0 += prio_rowpixels; } } @@ -1300,7 +1305,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b dest0 += dest_rowpixels; source0 += m_pixmap.rowpixels(); mask0 += m_flagsmap.rowpixels(); - pmap0 += priority_bitmap.rowpixels(); + pmap0 += prio_rowpixels; } } } @@ -1315,7 +1320,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b break; // advance to the next row on all our bitmaps - priority_baseaddr += priority_bitmap.rowpixels() * (nexty - y); + priority_baseaddr += prio_rowpixels * (nexty - y); source_baseaddr += m_pixmap.rowpixels() * (nexty - y); mask_baseaddr += m_flagsmap.rowpixels() * (nexty - y); dest_baseaddr += dest_rowpixels * (nexty - y); @@ -1559,10 +1564,14 @@ void tilemap_t::get_info_debug(u32 col, u32 row, u8 &gfxnum, u32 &code, u32 &col // get the GFX number and code gfxnum = m_tileinfo.gfxnum; code = m_tileinfo.code; + color = m_tileinfo.palette_base; - // work back from the palette base to get the color - const gfx_element &gfx = *m_tileinfo.decoder->gfx(gfxnum); - color = (m_tileinfo.palette_base - gfx.colorbase()) / gfx.granularity(); + if (gfxnum != 0xff) + { + // work back from the palette base to get the color + const gfx_element &gfx = *m_tileinfo.decoder->gfx(gfxnum); + color = (color - gfx.colorbase()) / gfx.granularity(); + } } @@ -1604,8 +1613,7 @@ tilemap_manager::~tilemap_manager() //------------------------------------------------- -// set_flip_all - set a global flip for all the -// tilemaps +// create - allocate a tilemap //------------------------------------------------- tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows, tilemap_t *allocated) |