mirror of
https://github.com/holub/mame
synced 2025-05-07 14:54:35 +03:00
Fix tilemap viewer. Tilemaps now use the bitmap's raw palette instead
of machine->pens to lookup RGB32 values if the palette is present (it is on all screen bitmaps). Today these are identical, but it's part of a long-term effort to move away from a global palette and allowing each bitmap or screen to have their own if that is preferred.
This commit is contained in:
parent
3902731437
commit
3d10a89945
@ -1184,6 +1184,7 @@ void tilemap_t::draw_instance(_BitmapClass &dest, const blit_parameters &blit, i
|
|||||||
x_end = MIN(x_end, x2);
|
x_end = MIN(x_end, x2);
|
||||||
|
|
||||||
// if we're rendering something, compute the pointers
|
// if we're rendering something, compute the pointers
|
||||||
|
const rgb_t *clut = (dest.palette() != NULL) ? palette_entry_list_raw(dest.palette()) : machine().pens;
|
||||||
if (prev_trans != WHOLLY_TRANSPARENT)
|
if (prev_trans != WHOLLY_TRANSPARENT)
|
||||||
{
|
{
|
||||||
const UINT16 *source0 = source_baseaddr + x_start;
|
const UINT16 *source0 = source_baseaddr + x_start;
|
||||||
@ -1200,9 +1201,9 @@ void tilemap_t::draw_instance(_BitmapClass &dest, const blit_parameters &blit, i
|
|||||||
else if (sizeof(*dest0) == 2)
|
else if (sizeof(*dest0) == 2)
|
||||||
scanline_draw_opaque_ind16(reinterpret_cast<UINT16 *>(dest0), source0, x_end - x_start, pmap0, blit.tilemap_priority_code);
|
scanline_draw_opaque_ind16(reinterpret_cast<UINT16 *>(dest0), source0, x_end - x_start, pmap0, blit.tilemap_priority_code);
|
||||||
else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff)
|
else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff)
|
||||||
scanline_draw_opaque_rgb32(reinterpret_cast<UINT32 *>(dest0), source0, x_end - x_start, machine().pens, pmap0, blit.tilemap_priority_code);
|
scanline_draw_opaque_rgb32(reinterpret_cast<UINT32 *>(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code);
|
||||||
else if (sizeof(*dest0) == 4)
|
else if (sizeof(*dest0) == 4)
|
||||||
scanline_draw_opaque_rgb32_alpha(reinterpret_cast<UINT32 *>(dest0), source0, x_end - x_start, machine().pens, pmap0, blit.tilemap_priority_code, blit.alpha);
|
scanline_draw_opaque_rgb32_alpha(reinterpret_cast<UINT32 *>(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha);
|
||||||
|
|
||||||
dest0 += dest_rowpixels;
|
dest0 += dest_rowpixels;
|
||||||
source0 += m_pixmap.rowpixels();
|
source0 += m_pixmap.rowpixels();
|
||||||
@ -1221,9 +1222,9 @@ void tilemap_t::draw_instance(_BitmapClass &dest, const blit_parameters &blit, i
|
|||||||
else if (sizeof(*dest0) == 2)
|
else if (sizeof(*dest0) == 2)
|
||||||
scanline_draw_masked_ind16(reinterpret_cast<UINT16 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, pmap0, blit.tilemap_priority_code);
|
scanline_draw_masked_ind16(reinterpret_cast<UINT16 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, pmap0, blit.tilemap_priority_code);
|
||||||
else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff)
|
else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff)
|
||||||
scanline_draw_masked_rgb32(reinterpret_cast<UINT32 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, machine().pens, pmap0, blit.tilemap_priority_code);
|
scanline_draw_masked_rgb32(reinterpret_cast<UINT32 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code);
|
||||||
else if (sizeof(*dest0) == 4)
|
else if (sizeof(*dest0) == 4)
|
||||||
scanline_draw_masked_rgb32_alpha(reinterpret_cast<UINT32 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, machine().pens, pmap0, blit.tilemap_priority_code, blit.alpha);
|
scanline_draw_masked_rgb32_alpha(reinterpret_cast<UINT32 *>(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha);
|
||||||
|
|
||||||
dest0 += dest_rowpixels;
|
dest0 += dest_rowpixels;
|
||||||
source0 += m_pixmap.rowpixels();
|
source0 += m_pixmap.rowpixels();
|
||||||
@ -1277,7 +1278,7 @@ void tilemap_t::draw_roz_core(_BitmapClass &destbitmap, const blit_parameters &b
|
|||||||
UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound)
|
UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound)
|
||||||
{
|
{
|
||||||
// pre-cache all the inner loop values
|
// pre-cache all the inner loop values
|
||||||
const pen_t *clut = &machine().pens[blit.tilemap_priority_code >> 16];
|
const rgb_t *clut = ((destbitmap.palette() != NULL) ? palette_entry_list_raw(destbitmap.palette()) : machine().pens) + (blit.tilemap_priority_code >> 16);
|
||||||
bitmap_ind8 &priority_bitmap = machine().priority_bitmap;
|
bitmap_ind8 &priority_bitmap = machine().priority_bitmap;
|
||||||
const int xmask = m_pixmap.width() - 1;
|
const int xmask = m_pixmap.width() - 1;
|
||||||
const int ymask = m_pixmap.height() - 1;
|
const int ymask = m_pixmap.height() - 1;
|
||||||
|
@ -1039,6 +1039,7 @@ static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state *state,
|
|||||||
|
|
||||||
/* allocate new stuff */
|
/* allocate new stuff */
|
||||||
state->bitmap = global_alloc(bitmap_rgb32(width, height));
|
state->bitmap = global_alloc(bitmap_rgb32(width, height));
|
||||||
|
state->bitmap->set_palette(machine.palette);
|
||||||
state->texture = machine.render().texture_alloc();
|
state->texture = machine.render().texture_alloc();
|
||||||
state->texture->set_bitmap(*state->bitmap, state->bitmap->cliprect(), TEXFORMAT_RGB32);
|
state->texture->set_bitmap(*state->bitmap, state->bitmap->cliprect(), TEXFORMAT_RGB32);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user