diff options
author | 2019-07-20 12:31:21 +1000 | |
---|---|---|
committer | 2019-07-20 12:31:21 +1000 | |
commit | d2926fa02cef5bf728eac74c9e5586aced02a80b (patch) | |
tree | 820d62305954ff68c7c8bb87c8a08d1b7ce4b2c3 /src/emu | |
parent | 24c462dbdb4ed2992af2f8767bf9c56979e7f1be (diff) | |
parent | 68139508715a0375e657add4197582271ef446ec (diff) |
Merge remote-tracking branch 'upstream/master'
# Conflicts:
# src/emu/digfx.h
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/digfx.cpp | 35 | ||||
-rw-r--r-- | src/emu/digfx.h | 6 | ||||
-rw-r--r-- | src/emu/drawgfx.cpp | 208 | ||||
-rw-r--r-- | src/emu/drawgfx.h | 72 | ||||
-rw-r--r-- | src/emu/drawgfxm.h | 10 | ||||
-rw-r--r-- | src/emu/tilemap.cpp | 6 | ||||
-rw-r--r-- | src/emu/tilemap.h | 8 |
7 files changed, 131 insertions, 214 deletions
diff --git a/src/emu/digfx.cpp b/src/emu/digfx.cpp index acc1c5f1176..0055421b80c 100644 --- a/src/emu/digfx.cpp +++ b/src/emu/digfx.cpp @@ -249,33 +249,16 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // otherwise, just use the line modulo else { - if (glcopy.planeoffset[1] != GFX_RAW) // 8bpp RAW case + int base = gfx.start; + int end = region_length/8; + int linemod = glcopy.yoffset[0]; + while (glcopy.total > 0) { - int base = gfx.start; - int end = region_length/8; - int linemod = glcopy.yoffset[0]; - while (glcopy.total > 0) - { - int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 8; - int lastpixelbase = elementbase + glcopy.height * linemod / 8 - 1; - if (lastpixelbase < end) - break; - glcopy.total--; - } - } - else // 16bpp RAW case - { - int base = gfx.start; - int end = region_length/16; - int linemod = glcopy.yoffset[0]; - while (glcopy.total > 0) - { - int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 16; - int lastpixelbase = elementbase + glcopy.height * linemod / 16 - 1; - if (lastpixelbase < end) - break; - glcopy.total--; - } + int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 8; + int lastpixelbase = elementbase + glcopy.height * linemod / 8 - 1; + if (lastpixelbase < end) + break; + glcopy.total--; } } diff --git a/src/emu/digfx.h b/src/emu/digfx.h index 1c9ebc2d6c5..b991ff15f12 100644 --- a/src/emu/digfx.h +++ b/src/emu/digfx.h @@ -24,7 +24,7 @@ //************************************************************************** constexpr u8 MAX_GFX_ELEMENTS = 32; -constexpr u16 MAX_GFX_PLANES = 16; +constexpr u16 MAX_GFX_PLANES = 8; // HBMAME - needed by monaco constexpr u16 MAX_GFX_SIZE = 64; @@ -39,9 +39,7 @@ constexpr u16 MAX_GFX_SIZE = 64; #define GFX_RAW 0x12345678 #define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \ -const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW, 0 }, { 0 }, { linemod }, charmod }; -#define GFXLAYOUT_RAW16( name, width, height, linemod, charmod ) \ -const gfx_layout name = { width, height, RGN_FRAC(1,1), 16, { GFX_RAW, GFX_RAW }, { 0 }, { linemod }, charmod }; +const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod }; // When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion. // No buffer is allocated for the decoded data, and gfxdata is set to point to the source // data. diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp index 5e317deb464..841ae7c670f 100644 --- a/src/emu/drawgfx.cpp +++ b/src/emu/drawgfx.cpp @@ -86,61 +86,53 @@ gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *ta // gfx_element - constructor //------------------------------------------------- -gfx_element::gfx_element(device_palette_interface *palette, const u8 *base, u32 total, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity) - : m_palette(palette) - , m_width(0) - , m_height(0) - , m_startx(0) - , m_starty(0) - , m_origwidth(0) - , m_origheight(0) - , m_total_elements(1) - , m_color_base(0) - , m_color_depth(0) - , m_color_granularity(0) - , m_total_colors(0) - , m_line_modulo(0) - , m_char_modulo(0) - , m_srcdata(nullptr) - , m_dirtyseq(1) - , m_gfxdata(nullptr) - , m_layout_is_raw(true) - , m_layout_is_16bpp(false) - , m_layout_planes(0) - , m_layout_xormask(0) - , m_layout_charincrement(0) -{ - if (!total) total = 1; - // set the layout - set_raw_layout(base, width, height, total, rowbytes*8, width*height*8); - m_color_base = color_base; - m_color_depth = m_color_granularity = color_granularity; - m_total_colors = (total_colors - color_base) / color_granularity; +gfx_element::gfx_element(device_palette_interface *palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity) + : m_palette(palette), + m_width(width), + m_height(height), + m_startx(0), + m_starty(0), + m_origwidth(width), + m_origheight(height), + m_total_elements(1), + m_color_base(color_base), + m_color_depth(color_granularity), + m_color_granularity(color_granularity), + m_total_colors((total_colors - color_base) / color_granularity), + m_line_modulo(rowbytes), + m_char_modulo(0), + m_srcdata(base), + m_dirtyseq(1), + m_gfxdata(base), + m_layout_is_raw(true), + m_layout_planes(0), + m_layout_xormask(0), + m_layout_charincrement(0) +{ } gfx_element::gfx_element(device_palette_interface *palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base) - : m_palette(palette) - , m_width(0) - , m_height(0) - , m_startx(0) - , m_starty(0) - , m_origwidth(0) - , m_origheight(0) - , m_total_elements(0) - , m_color_base(color_base) - , m_color_depth(0) - , m_color_granularity(0) - , m_total_colors(total_colors) - , m_line_modulo(0) - , m_char_modulo(0) - , m_srcdata(nullptr) - , m_dirtyseq(1) - , m_gfxdata(nullptr) - , m_layout_is_raw(false) - , m_layout_is_16bpp(false) - , m_layout_planes(0) - , m_layout_xormask(xormask) - , m_layout_charincrement(0) + : m_palette(palette), + m_width(0), + m_height(0), + m_startx(0), + m_starty(0), + m_origwidth(0), + m_origheight(0), + m_total_elements(0), + m_color_base(color_base), + m_color_depth(0), + m_color_granularity(0), + m_total_colors(total_colors), + m_line_modulo(0), + m_char_modulo(0), + m_srcdata(nullptr), + m_dirtyseq(1), + m_gfxdata(nullptr), + m_layout_is_raw(false), + m_layout_planes(0), + m_layout_xormask(xormask), + m_layout_charincrement(0) { // set the layout set_layout(gl, srcdata); @@ -164,7 +156,6 @@ void gfx_element::set_layout(const gfx_layout &gl, const u8 *srcdata) // copy data from the layout m_layout_is_raw = (gl.planeoffset[0] == GFX_RAW); - m_layout_is_16bpp = (gl.planeoffset[1] == GFX_RAW); m_layout_planes = gl.planes; m_layout_charincrement = gl.charincrement; @@ -175,22 +166,15 @@ void gfx_element::set_layout(const gfx_layout &gl, const u8 *srcdata) m_layout_planeoffset.clear(); m_layout_xoffset.clear(); m_layout_yoffset.clear(); + m_gfxdata_allocated.clear(); // modulos are determined for us by the layout - if (m_layout_is_16bpp) - { - m_line_modulo = gl.yoffs(0) / 16; - m_char_modulo = gl.charincrement / 16; - } - else - { - m_line_modulo = gl.yoffs(0) / 8; - m_char_modulo = gl.charincrement / 8; - } + m_line_modulo = gl.yoffs(0) / 8; + m_char_modulo = gl.charincrement / 8; - // allocate memory for the data - m_gfxdata_allocated.resize(m_total_elements * m_char_modulo); - m_gfxdata = &m_gfxdata_allocated[0]; + // RAW graphics must have a pointer up front + assert(srcdata != nullptr); + m_gfxdata = const_cast<u8 *>(srcdata); } // decoded graphics case @@ -241,26 +225,11 @@ void gfx_element::set_raw_layout(const u8 *srcdata, u32 width, u32 height, u32 t layout.total = total; layout.planes = 8; layout.planeoffset[0] = GFX_RAW; - layout.planeoffset[1] = 0; layout.yoffset[0] = linemod; layout.charincrement = charmod; set_layout(layout, srcdata); } -void gfx_element::set_raw_layout(const u16 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod) -{ - gfx_layout layout = { 0 }; - layout.width = width; - layout.height = height; - layout.total = total; - layout.planes = 8; - layout.planeoffset[0] = GFX_RAW; - layout.planeoffset[1] = GFX_RAW; - layout.yoffset[0] = linemod; - layout.charincrement = charmod; - set_layout(layout, (const u8 *)srcdata); -} - //------------------------------------------------- // set_source - set the source data for a gfx_element @@ -270,6 +239,7 @@ void gfx_element::set_source(const u8 *source) { m_srcdata = source; memset(&m_dirty[0], 1, elements()); + if (m_layout_is_raw) m_gfxdata = const_cast<u8 *>(source); } @@ -291,9 +261,16 @@ void gfx_element::set_source_and_total(const u8 *source, u32 total) if (m_color_depth <= 32) m_pen_usage.resize(m_total_elements); - // allocate memory for the data - m_gfxdata_allocated.resize(m_total_elements * m_char_modulo); - m_gfxdata = &m_gfxdata_allocated[0]; + if (m_layout_is_raw) + { + m_gfxdata = const_cast<u8 *>(source); + } + else + { + // allocate memory for the data + m_gfxdata_allocated.resize(m_total_elements * m_char_modulo); + m_gfxdata = &m_gfxdata_allocated[0]; + } } @@ -322,49 +299,10 @@ void gfx_element::set_source_clip(u32 xoffs, u32 width, u32 yoffs, u32 height) void gfx_element::decode(u32 code) { // don't decode GFX_RAW - if (m_layout_is_raw) - { - if (m_layout_is_16bpp) - { - // zap the data to 0 - u16 *decode_base = m_gfxdata + code * m_char_modulo; - const u16 *base = ((const u16 *)m_srcdata) + code * m_char_modulo; - memset(decode_base, 0, m_char_modulo); - - // iterate over rows - for (int y = 0; y < m_origheight; y++) - { - const u16 *sp = base + y * m_line_modulo; - u16 *dp = decode_base + y * m_line_modulo; - - // iterate over columns - for (int x = 0; x < m_origwidth; x++) - dp[x] = sp[x]; - } - } - else - { - // zap the data to 0 - u16 *decode_base = m_gfxdata + code * m_char_modulo; - const u8 *base = m_srcdata + code * m_char_modulo; - memset(decode_base, 0, m_char_modulo); - - // iterate over rows - for (int y = 0; y < m_origheight; y++) - { - const u8 *sp = base + y * m_line_modulo; - u16 *dp = decode_base + y * m_line_modulo; - - // iterate over columns - for (int x = 0; x < m_origwidth; x++) - dp[x] = sp[x]; - } - } - } - else + if (!m_layout_is_raw) { // zap the data to 0 - u16 *decode_base = m_gfxdata + code * m_char_modulo; + u8 *decode_base = m_gfxdata + code * m_char_modulo; memset(decode_base, 0, m_char_modulo); // iterate over planes @@ -379,7 +317,7 @@ void gfx_element::decode(u32 code) for (int y = 0; y < m_origheight; y++) { int yoffs = planeoffs + m_layout_yoffset[y]; - u16 *dp = decode_base + y * m_line_modulo; + u8 *dp = decode_base + y * m_line_modulo; // iterate over columns for (int x = 0; x < m_origwidth; x++) @@ -393,7 +331,7 @@ void gfx_element::decode(u32 code) if (code < m_pen_usage.size()) { // iterate over data, creating a bitmask of live pens - const u16 *dp = m_gfxdata + code * m_char_modulo; + const u8 *dp = m_gfxdata + code * m_char_modulo; u32 usage = 0; for (int y = 0; y < m_origheight; y++) { @@ -450,7 +388,7 @@ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect, u32 trans_pen) { // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty); // use pen usage to optimize @@ -478,7 +416,7 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, u32 trans_pen) { // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty); // use pen usage to optimize @@ -716,7 +654,7 @@ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, return transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen); // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize @@ -748,7 +686,7 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, return transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen); // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize @@ -1008,7 +946,7 @@ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize @@ -1038,7 +976,7 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize @@ -1301,7 +1239,7 @@ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &clipre return prio_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen); // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize @@ -1336,7 +1274,7 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre return prio_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen); // special case invalid pens to opaque - if (trans_pen > 0xffff) + if (trans_pen > 0xff) return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index 16902a6c932..4d3f4d0e0c9 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -152,7 +152,7 @@ public: gfx_element(); #endif gfx_element(device_palette_interface *palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base); - gfx_element(device_palette_interface *palette, const u8 *base, u32 total, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity); + gfx_element(device_palette_interface *palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity); // getters device_palette_interface &palette() const { return *m_palette; } @@ -173,7 +173,6 @@ public: // setters void set_layout(const gfx_layout &gl, const u8 *srcdata); void set_raw_layout(const u8 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod); - void set_raw_layout(const u16 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod); void set_source(const u8 *source); void set_source_and_total(const u8 *source, u32 total); void set_xormask(u32 xormask) { m_layout_xormask = xormask; } @@ -187,7 +186,7 @@ public: void mark_dirty(u32 code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } } void mark_all_dirty() { memset(&m_dirty[0], 1, elements()); } - const u16 *get_data(u32 code) + const u8 *get_data(u32 code) { assert(code < elements()); if (code < m_dirty.size() && m_dirty[code]) decode(code); @@ -271,40 +270,39 @@ private: void decode(u32 code); // internal state - device_palette_interface *m_palette; // palette used for drawing (optional when used as a pure decoder) - - u16 m_width; // current pixel width of each element (changeable with source clipping) - u16 m_height; // current pixel height of each element (changeable with source clipping) - u16 m_startx; // current source clip X offset - u16 m_starty; // current source clip Y offset - - u16 m_origwidth; // starting pixel width of each element - u16 m_origheight; // staring pixel height of each element - u32 m_total_elements; // total number of decoded elements - - u32 m_color_base; // base color for rendering - u16 m_color_depth; // number of colors each pixel can represent - u16 m_color_granularity; // number of colors for each color code - u32 m_total_colors; // number of color codes - - u32 m_line_modulo; // bytes between each row of data - u32 m_char_modulo; // bytes between each element - const u8 * m_srcdata; // pointer to the source data for decoding - u32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied - - u16 * m_gfxdata; // pointer to decoded pixel data, 16bpp - std::vector<u16> m_gfxdata_allocated; // allocated decoded pixel data, 8bpp - std::vector<u8> m_dirty; // dirty array for detecting chars that need decoding - std::vector<u32> m_pen_usage; // bitmask of pens that are used (pens 0-31 only) - - bool m_layout_is_raw; // raw layout? - bool m_layout_is_16bpp; // 16bpp raw layout? - u8 m_layout_planes; // bit planes in the layout - u32 m_layout_xormask; // xor mask applied to each bit offset - u32 m_layout_charincrement; // per-character increment in source data - std::vector<u32> m_layout_planeoffset; // plane offsets - std::vector<u32> m_layout_xoffset; // X offsets - std::vector<u32> m_layout_yoffset; // Y offsets + device_palette_interface *m_palette; // palette used for drawing (optional when used as a pure decoder) + + u16 m_width; // current pixel width of each element (changeable with source clipping) + u16 m_height; // current pixel height of each element (changeable with source clipping) + u16 m_startx; // current source clip X offset + u16 m_starty; // current source clip Y offset + + u16 m_origwidth; // starting pixel width of each element + u16 m_origheight; // staring pixel height of each element + u32 m_total_elements; // total number of decoded elements + + u32 m_color_base; // base color for rendering + u16 m_color_depth; // number of colors each pixel can represent + u16 m_color_granularity; // number of colors for each color code + u32 m_total_colors; // number of color codes + + u32 m_line_modulo; // bytes between each row of data + u32 m_char_modulo; // bytes between each element + const u8 * m_srcdata; // pointer to the source data for decoding + u32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied + + u8 * m_gfxdata; // pointer to decoded pixel data, 8bpp + std::vector<u8> m_gfxdata_allocated; // allocated decoded pixel data, 8bpp + std::vector<u8> m_dirty; // dirty array for detecting chars that need decoding + std::vector<u32> m_pen_usage; // bitmask of pens that are used (pens 0-31 only) + + bool m_layout_is_raw; // raw layout? + u8 m_layout_planes; // bit planes in the layout + u32 m_layout_xormask; // xor mask applied to each bit offset + u32 m_layout_charincrement; // per-character increment in source data + std::vector<u32> m_layout_planeoffset;// plane offsets + std::vector<u32> m_layout_xoffset; // X offsets + std::vector<u32> m_layout_yoffset; // Y offsets }; diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index e6f2b363272..6361ed8bf92 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -470,7 +470,7 @@ while (0) do { \ g_profiler.start(PROFILER_DRAWGFX); \ do { \ - const u16 *srcdata; \ + const u8 *srcdata; \ s32 destendx, destendy; \ s32 srcx, srcy; \ s32 curx, cury; \ @@ -549,7 +549,7 @@ do { { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u16 *srcptr = srcdata; \ + const u8 *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -584,7 +584,7 @@ do { { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u16 *srcptr = srcdata; \ + const u8 *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -642,7 +642,7 @@ do { do { \ g_profiler.start(PROFILER_DRAWGFX); \ do { \ - const u16 *srcdata; \ + const u8 *srcdata; \ u32 dstwidth, dstheight; \ s32 destendx, destendy; \ s32 srcx, srcy; \ @@ -730,7 +730,7 @@ do { { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u16 *srcptr = srcdata + (srcy >> 16) * rowbytes(); \ + const u8 *srcptr = srcdata + (srcy >> 16) * rowbytes(); \ s32 cursrcx = srcx; \ srcy += dy; \ \ diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 460e511336e..c5c0ff16ad3 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -401,7 +401,7 @@ tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decod // set up the default tile data memset(&m_tileinfo, 0, sizeof(m_tileinfo)); m_tileinfo.decoder = &decoder; - m_tileinfo.pen_mask = 0xffff; + m_tileinfo.pen_mask = 0xff; m_tileinfo.gfxnum = 0xff; // allocate transparency mapping data @@ -780,7 +780,7 @@ g_profiler.stop(); // the palette_base //------------------------------------------------- -u8 tilemap_t::tile_draw(const u16 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u16 pen_mask) +u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u8 pen_mask) { // OR in the force layer flags category |= flags & (TILE_FORCE_LAYER0 | TILE_FORCE_LAYER1 | TILE_FORCE_LAYER2); @@ -816,7 +816,7 @@ u8 tilemap_t::tile_draw(const u16 *pendata, u32 x0, u32 y0, u32 palette_base, u8 int xoffs = 0; for (u16 tx = 0; tx < m_tilewidth; tx++) { - u16 pen = (*pendata++) & pen_mask; + u8 pen = (*pendata++) & pen_mask; u8 map = penmap[pen]; pixptr[xoffs] = palette_base + pen; flagsptr[xoffs] = map | category; diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h index d73b3a23ef0..15794247a4f 100644 --- a/src/emu/tilemap.h +++ b/src/emu/tilemap.h @@ -372,13 +372,13 @@ typedef u32 tilemap_memory_index; struct tile_data { device_gfx_interface *decoder; // set in tilemap_t::init() - const u16 * pen_data; // required + const u8 * pen_data; // required const u8 * mask_data; // required pen_t palette_base; // defaults to 0 u8 category; // defaults to 0; range from 0..15 u8 group; // defaults to 0; range from 0..TILEMAP_NUM_GROUPS u8 flags; // defaults to 0; one or more of TILE_* flags above - u16 pen_mask; // defaults to 0xff; mask to apply to pen_data while rendering the tile + u8 pen_mask; // defaults to 0xff; mask to apply to pen_data while rendering the tile u8 gfxnum; // defaults to 0xff; specify index of gfx for auto-invalidation on dirty u32 code; @@ -421,7 +421,7 @@ class tilemap_t static const logical_index INVALID_LOGICAL_INDEX = (logical_index)~0; // maximum index in each array - static const pen_t MAX_PEN_TO_FLAGS = 65536; + static const pen_t MAX_PEN_TO_FLAGS = 256; protected: // tilemap_manager controls our allocations @@ -548,7 +548,7 @@ private: // internal drawing void pixmap_update(); void tile_update(logical_index logindex, u32 col, u32 row); - u8 tile_draw(const u16 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u16 pen_mask); + u8 tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u8 pen_mask); u8 tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category, u8 flags); void configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask); template<class _BitmapClass> void draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask); |