diff options
author | Aaron Giles <aaron@aarongiles.com> | 2012-09-06 06:19:32 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2012-09-06 06:19:32 +0000 |
commit | a50849088e1406403ffdef0c15b97e74923c3bee (patch) | |
tree | 03e9309750dd1fee44133092444866cee09ac404 /src/emu | |
parent | 16c2e208e340d22f24163da9007051c8d8e063f5 (diff) |
gfx_element is now a class. Accessors are provided for all
necessary elements. Updated some of the more, ah, creative
uses/abuses of the gfx_elements. [Aaron Giles]
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/drawgfx.c | 731 | ||||
-rw-r--r-- | src/emu/drawgfx.h | 417 | ||||
-rw-r--r-- | src/emu/drawgfxm.h | 32 | ||||
-rw-r--r-- | src/emu/emupal.c | 14 | ||||
-rw-r--r-- | src/emu/emupal.h | 4 | ||||
-rw-r--r-- | src/emu/machine/tc009xlvc.c | 16 | ||||
-rw-r--r-- | src/emu/tilemap.c | 6 | ||||
-rw-r--r-- | src/emu/tilemap.h | 16 | ||||
-rw-r--r-- | src/emu/uigfx.c | 48 | ||||
-rw-r--r-- | src/emu/video.c | 2 |
10 files changed, 627 insertions, 659 deletions
diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index 3d23dcbbad5..a5a84a7f1f4 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -25,14 +25,6 @@ bitmap_ind8 drawgfx_dummy_priority_bitmap; /*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -static void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src); - - - -/*************************************************************************** INLINE FUNCTIONS ***************************************************************************/ @@ -208,253 +200,252 @@ void gfx_init(running_machine &machine) glcopy.total = total; // allocate the graphics - machine.gfx[curgfx] = gfx_element_alloc(machine, &glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start); + machine.gfx[curgfx] = auto_alloc(machine, gfx_element(machine, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start)); } } -/*------------------------------------------------- - gfx_element_alloc - allocate a gfx_element structure - based on a given layout --------------------------------------------------*/ - -gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base) -{ - int israw = (gl->planeoffset[0] == GFX_RAW); - int planes = gl->planes; - UINT16 width = gl->width; - UINT16 height = gl->height; - UINT32 total = gl->total; - gfx_element *gfx; - - // allocate memory for the gfx_element structure - gfx = auto_alloc_clear(machine, gfx_element(machine)); - - // fill in the data - gfx->width = width; - gfx->height = height; - - gfx->origwidth = width; - gfx->origheight = height; - gfx->total_elements = total; - - gfx->color_base = color_base; - gfx->color_depth = 1 << planes; - gfx->color_granularity = 1 << planes; - gfx->total_colors = total_colors; - - gfx->srcdata = srcdata; - - // copy the layout - gfx->layout = *gl; - if (gfx->layout.extxoffs != NULL) - { - if (gfx->layout.width < ARRAY_LENGTH(gfx->layout.xoffset)) - { - memcpy(gfx->layout.xoffset, gfx->layout.extxoffs, sizeof(gfx->layout.xoffset[0]) * gfx->layout.width); - gfx->layout.extxoffs = NULL; - } - else - { - UINT32 *buffer = auto_alloc_array(machine, UINT32, gfx->layout.width); - memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width); - gfx->layout.extxoffs = buffer; - } - } - - if (gfx->layout.extyoffs != NULL) - { - if (gfx->layout.height < ARRAY_LENGTH(gfx->layout.yoffset)) - { - memcpy(gfx->layout.yoffset, gfx->layout.extyoffs, sizeof(gfx->layout.yoffset[0]) * gfx->layout.height); - gfx->layout.extyoffs = NULL; - } - else - { - UINT32 *buffer = auto_alloc_array(machine, UINT32, gfx->layout.height); - memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height); - gfx->layout.extyoffs = buffer; - } - } - - // allocate a pen usage array for entries with 32 pens or less - if (gfx->color_depth <= 32) - gfx->pen_usage = auto_alloc_array(machine, UINT32, gfx->total_elements); - - // allocate a dirty array - gfx->dirty = auto_alloc_array(machine, UINT8, gfx->total_elements); - memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty)); +//------------------------------------------------- +// gfx_element - constructor +//------------------------------------------------- + +gfx_element::gfx_element(running_machine &machine) + : 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(0), + m_color_depth(0), + m_color_granularity(0), + m_total_colors(0), + m_line_modulo(0), + m_char_modulo(0), + m_srcdata(NULL), + m_dirtyseq(1), + m_gfxdata(NULL), + m_layout_is_raw(false), + m_layout_planes(0), + m_layout_charincrement(0), + m_machine(machine) +{ +} + +gfx_element::gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity) + : 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((machine.total_colors() - color_base) / color_granularity), + m_line_modulo(rowbytes), + m_char_modulo(0), + m_srcdata(base), + m_dirtyseq(1), + m_gfxdata(NULL), + m_layout_is_raw(false), + m_layout_planes(0), + m_layout_charincrement(0), + m_machine(machine) +{ +} + +gfx_element::gfx_element(running_machine &machine, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base) + : 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(NULL), + m_dirtyseq(1), + m_gfxdata(NULL), + m_layout_is_raw(false), + m_layout_planes(0), + m_layout_charincrement(0), + m_machine(machine) +{ + // set the layout + set_layout(gl, srcdata); +} + + +//------------------------------------------------- +// set_layout - set the layout for a gfx_element +//------------------------------------------------- + +void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata) +{ + // configure ourselves + m_width = m_origwidth = gl.width; + m_height = m_origheight = gl.height; + m_startx = m_starty = 0; + m_total_elements = gl.total; + m_color_depth = m_color_granularity = 1 << gl.planes; + + // copy data from the layout + m_layout_is_raw = (gl.planeoffset[0] == GFX_RAW); + m_layout_planes = gl.planes; + m_layout_charincrement = gl.charincrement; + m_layout_planeoffset.resize(m_layout_planes); + m_layout_xoffset.resize(m_width); + m_layout_yoffset.resize(m_height); // raw graphics case - if (israw) + if (m_layout_is_raw) { // modulos are determined for us by the layout - gfx->line_modulo = (gl->extyoffs ? gl->extyoffs[0] : gl->yoffset[0]) / 8; - gfx->char_modulo = gl->charincrement / 8; - - // don't free the data because we will get a pointer at decode time - gfx->flags |= GFX_ELEMENT_DONT_FREE; + m_line_modulo = ((gl.extyoffs != NULL) ? gl.extyoffs[0] : gl.yoffset[0]) / 8; + m_char_modulo = gl.charincrement / 8; // RAW graphics must have a pointer up front - gfx->gfxdata = (UINT8 *)gfx->srcdata; + assert(srcdata != NULL); + m_gfxdata_allocated.reset(); + m_gfxdata = const_cast<UINT8 *>(m_srcdata); } // decoded graphics case else { + // copy offsets + for (int p = 0; p < m_layout_planes; p++) + m_layout_planeoffset[p] = gl.planeoffset[p]; + for (int y = 0; y < m_height; y++) + m_layout_yoffset[y] = gl.yoffs(y); + for (int x = 0; x < m_width; x++) + m_layout_xoffset[x] = gl.xoffs(x); + // we get to pick our own modulos - gfx->line_modulo = gfx->origwidth; - gfx->char_modulo = gfx->line_modulo * gfx->origheight; + m_line_modulo = m_origwidth; + m_char_modulo = m_line_modulo * m_origheight; // allocate memory for the data - gfx->gfxdata = auto_alloc_array(machine, UINT8, gfx->total_elements * gfx->char_modulo); + m_gfxdata_allocated.resize(m_total_elements * m_char_modulo); + m_gfxdata = &m_gfxdata_allocated[0]; } - return gfx; -} - - -/*------------------------------------------------- - gfx_element_decode - update a single code in - a gfx_element --------------------------------------------------*/ + // mark everything dirty + m_dirty.resize(m_total_elements); + memset(m_dirty, 1, m_total_elements); -void gfx_element_decode(const gfx_element *gfx, UINT32 code) -{ - decodechar(gfx, code, gfx->srcdata); + // allocate a pen usage array for entries with 32 pens or less + if (m_color_depth <= 32) + m_pen_usage.resize(m_total_elements); + else + m_pen_usage.reset(); + + // set the source + set_source(srcdata); } -/*------------------------------------------------- - gfx_element_free - free a gfx_element --------------------------------------------------*/ +//------------------------------------------------- +// set_raw_layout - set the layout for a gfx_element +//------------------------------------------------- -void gfx_element_free(gfx_element *gfx) +void gfx_element::set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 height, UINT32 total, UINT32 linemod, UINT32 charmod) { - // ignore NULL frees - if (gfx == NULL) - return; - - // free our data - auto_free(gfx->machine(), gfx->layout.extyoffs); - auto_free(gfx->machine(), gfx->layout.extxoffs); - auto_free(gfx->machine(), gfx->pen_usage); - auto_free(gfx->machine(), gfx->dirty); - auto_free(gfx->machine(), gfx->gfxdata); - auto_free(gfx->machine(), gfx); + gfx_layout layout = { 0 }; + layout.width = width; + layout.height = height; + layout.total = total; + layout.planes = 8; + layout.planeoffset[0] = GFX_RAW; + layout.yoffset[0] = linemod; + layout.charincrement = charmod; + set_layout(layout, srcdata); } -/*------------------------------------------------- - gfx_element_build_temporary - create a - temporary one-off gfx_element --------------------------------------------------*/ +//------------------------------------------------- +// set_source_clip - set a source clipping rect +//------------------------------------------------- -void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags) +void gfx_element::set_source_clip(UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height) { - static UINT8 not_dirty = 0; - - gfx->width = width; - gfx->height = height; - gfx->startx = 0; - gfx->starty = 0; - - gfx->origwidth = width; - gfx->origheight = height; - gfx->flags = flags; - gfx->total_elements = 1; - - gfx->color_base = color_base; - gfx->color_depth = color_granularity; - gfx->color_granularity = color_granularity; - gfx->total_colors = (machine.total_colors() - color_base) / color_granularity; - - gfx->pen_usage = NULL; + assert(xoffs < m_origwidth); + assert(yoffs < m_origheight); + assert(xoffs + width <= m_origwidth); + assert(yoffs + height <= m_origheight); - gfx->gfxdata = base; - gfx->line_modulo = rowbytes; - gfx->char_modulo = 0; - gfx->srcdata = base; - gfx->dirty = ¬_dirty; - gfx->dirtyseq = 0; + m_width = width; + m_height = height; + m_startx = xoffs; + m_starty = yoffs; } -/*------------------------------------------------- - calc_penusage - calculate the pen usage for - a given graphics tile --------------------------------------------------*/ +//------------------------------------------------- +// decode - decode a single character +//------------------------------------------------- -static void calc_penusage(const gfx_element *gfx, UINT32 code) +void gfx_element::decode(UINT32 code) { - const UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo; - UINT32 usage = 0; - int x, y; - - // if nothing allocated, don't do it - if (gfx->pen_usage == NULL) - return; - - for (y = 0; y < gfx->origheight; y++) - { - for (x = 0; x < gfx->origwidth; x++) - usage |= 1 << dp[x]; - - dp += gfx->line_modulo; - } - - // store the final result - gfx->pen_usage[code] = usage; -} - - -/*------------------------------------------------- - decodechar - decode a single character based - on a specified layout --------------------------------------------------*/ - -static void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src) -{ - const gfx_layout *gl = &gfx->layout; - int israw = (gl->planeoffset[0] == GFX_RAW); - int planes = gl->planes; - UINT32 charincrement = gl->charincrement; - const UINT32 *poffset = gl->planeoffset; - const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset; - const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset; - UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo; - int plane, x, y; - - if (!israw) + // don't decode GFX_RAW + if (!m_layout_is_raw) { // zap the data to 0 - memset(dp, 0, gfx->char_modulo); - for (plane = 0; plane < planes; plane++) + UINT8 *decode_base = m_gfxdata + code * m_char_modulo; + memset(decode_base, 0, m_char_modulo); + + // iterate over planes + for (int plane = 0; plane < m_layout_planes; plane++) { - int planebit = 1 << (planes - 1 - plane); - int planeoffs = code * charincrement + poffset[plane]; + int planebit = 1 << (m_layout_planes - 1 - plane); + int planeoffs = code * m_layout_charincrement + m_layout_planeoffset[plane]; - for (y = 0; y < gfx->origheight; y++) + // iterate over rows + for (int y = 0; y < m_origheight; y++) { - int yoffs = planeoffs + yoffset[y]; - - dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo; - for (x = 0; x < gfx->origwidth; x++) - if (readbit(src, yoffs + xoffset[x])) + int yoffs = planeoffs + m_layout_yoffset[y]; + UINT8 *dp = decode_base + y * rowbytes(); + + // iterate over columns + for (int x = 0; x < m_origwidth; x++) + if (readbit(m_srcdata, yoffs + m_layout_xoffset[x])) dp[x] |= planebit; } } } - // compute pen usage - calc_penusage(gfx, code); + // (re)compute pen usage + if (code < m_pen_usage.count()) + { + // iterate over data, creating a bitmask of live pens + const UINT8 *dp = m_gfxdata + code * m_char_modulo; + UINT32 usage = 0; + for (int y = 0; y < m_origheight; y++) + { + for (int x = 0; x < m_origwidth; x++) + usage |= 1 << dp[x]; + dp += m_line_modulo; + } + + // store the final result + m_pen_usage[code] = usage; + } // no longer dirty - gfx->dirty[code] = 0; + m_dirty[code] = 0; } + /*************************************************************************** DRAWGFX IMPLEMENTATIONS ***************************************************************************/ @@ -464,20 +455,20 @@ static void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src) no transparency -------------------------------------------------*/ -void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty) { - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } -void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty) { - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } @@ -488,7 +479,7 @@ void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ele a single transparent pen -------------------------------------------------*/ -void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen) { @@ -497,11 +488,11 @@ void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_e return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -511,12 +502,12 @@ void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_e } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } -void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen) { @@ -525,11 +516,11 @@ void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_e return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -539,7 +530,7 @@ void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_e } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } @@ -551,13 +542,13 @@ void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_e lookups -------------------------------------------------*/ -void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen) { // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // render @@ -565,13 +556,13 @@ void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const g DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } -void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen) { // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // render @@ -586,7 +577,7 @@ void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const g a mask -------------------------------------------------*/ -void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask) { @@ -595,11 +586,11 @@ void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_ return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -609,12 +600,12 @@ void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_ } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } -void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask) { @@ -623,11 +614,11 @@ void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -637,7 +628,7 @@ void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } @@ -649,28 +640,28 @@ void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ transparent, opaque, or shadowing -------------------------------------------------*/ -void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable) { assert(pentable != NULL); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY); } -void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable) { assert(pentable != NULL); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); } @@ -682,7 +673,7 @@ void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx remaining pixels with a fixed alpha value -------------------------------------------------*/ -void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha) { @@ -691,12 +682,12 @@ void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_elem return drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // get final code and color, and grab lookup tables - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); } @@ -712,7 +703,7 @@ void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_elem element with no transparency -------------------------------------------------*/ -void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley) { @@ -721,13 +712,13 @@ void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } -void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley) { @@ -736,8 +727,8 @@ void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } @@ -748,7 +739,7 @@ void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx element with a single transparent pen -------------------------------------------------*/ -void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen) { @@ -761,11 +752,11 @@ void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const g return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -775,12 +766,12 @@ void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const g } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } -void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen) { @@ -793,11 +784,11 @@ void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const g return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -807,7 +798,7 @@ void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const g } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } @@ -819,7 +810,7 @@ void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const g color lookups -------------------------------------------------*/ -void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen) { @@ -828,8 +819,8 @@ void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, con return drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // render @@ -837,7 +828,7 @@ void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, con DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } -void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen) { @@ -846,8 +837,8 @@ void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, con return drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // render @@ -862,7 +853,7 @@ void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, con provided as a mask -------------------------------------------------*/ -void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask) { @@ -875,11 +866,11 @@ void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -889,12 +880,12 @@ void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } -void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask) { @@ -907,11 +898,11 @@ void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -921,7 +912,7 @@ void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const } // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } @@ -933,7 +924,7 @@ void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const are transparent, opaque, or shadowing -------------------------------------------------*/ -void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable) { @@ -944,13 +935,13 @@ void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const return drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY); } -void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable) { @@ -961,8 +952,8 @@ void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const return drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable); // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); } @@ -974,7 +965,7 @@ void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const the remaining pixels with a fixed alpha value -------------------------------------------------*/ -void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha) { @@ -987,12 +978,12 @@ void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ return drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DECLARE_NO_PRIORITY; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); } @@ -1009,7 +1000,7 @@ void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ bitmap -------------------------------------------------*/ -void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask) { @@ -1017,12 +1008,12 @@ void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_el pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); } -void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask) { @@ -1030,8 +1021,8 @@ void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_el pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); } @@ -1042,7 +1033,7 @@ void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_el priority bitmap -------------------------------------------------*/ -void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) { @@ -1051,11 +1042,11 @@ void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_ return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -1068,11 +1059,11 @@ void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_ pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); } -void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) { @@ -1081,11 +1072,11 @@ void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -1098,7 +1089,7 @@ void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); } @@ -1109,13 +1100,13 @@ void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ lookups, checking against the priority bitmap -------------------------------------------------*/ -void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) { // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on @@ -1125,13 +1116,13 @@ void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); } -void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) { // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on @@ -1148,7 +1139,7 @@ void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const a mask, checking against the priority bitmap -------------------------------------------------*/ -void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask) { @@ -1157,11 +1148,11 @@ void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -1174,11 +1165,11 @@ void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); } -void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask) { @@ -1187,11 +1178,11 @@ void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -1204,7 +1195,7 @@ void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); } @@ -1216,7 +1207,7 @@ void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx against the priority bitmap -------------------------------------------------*/ -void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable) { @@ -1226,12 +1217,12 @@ void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gf pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8); } -void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable) { @@ -1241,8 +1232,8 @@ void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gf pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8); } @@ -1254,7 +1245,7 @@ void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gf checking against the priority bitmap -------------------------------------------------*/ -void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha) { @@ -1263,15 +1254,15 @@ void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ele return pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8); } @@ -1287,7 +1278,7 @@ void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_ele the priority bitmap -------------------------------------------------*/ -void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask) { @@ -1299,12 +1290,12 @@ void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gf pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); } -void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask) { @@ -1316,8 +1307,8 @@ void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gf pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); } @@ -1328,7 +1319,7 @@ void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gf checking against the priority bitmap -------------------------------------------------*/ -void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) @@ -1342,11 +1333,11 @@ void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -1359,11 +1350,11 @@ void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); } -void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) @@ -1377,11 +1368,11 @@ void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~(1 << transpen)) == 0) return; @@ -1394,7 +1385,7 @@ void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); } @@ -1406,7 +1397,7 @@ void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap -------------------------------------------------*/ -void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) @@ -1416,8 +1407,8 @@ void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, co return pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on @@ -1427,7 +1418,7 @@ void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, co DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); } -void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen) @@ -1437,8 +1428,8 @@ void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, co return pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on @@ -1456,7 +1447,7 @@ void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, co priority bitmap -------------------------------------------------*/ -void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask) @@ -1470,11 +1461,11 @@ void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -1487,11 +1478,11 @@ void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); } -void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask) @@ -1505,11 +1496,11 @@ void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); // use pen usage to optimize - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code]) + code %= gfx->elements(); + if (gfx->has_pen_usage()) { // fully transparent; do nothing - UINT32 usage = gfx->pen_usage[code]; + UINT32 usage = gfx->pen_usage(code); if ((usage & ~transmask) == 0) return; @@ -1522,7 +1513,7 @@ void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); } @@ -1534,7 +1525,7 @@ void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const checking against the priority bitmap -------------------------------------------------*/ -void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable) @@ -1549,12 +1540,12 @@ void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, cons pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8); } -void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable) @@ -1569,8 +1560,8 @@ void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, cons pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - code %= gfx->total_elements; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; + code %= gfx->elements(); DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8); } @@ -1583,7 +1574,7 @@ void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, cons bitmap -------------------------------------------------*/ -void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, +void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha) @@ -1597,15 +1588,15 @@ void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx return pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, transpen); // early out if completely transparent - code %= gfx->total_elements; - if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) + code %= gfx->elements(); + if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0) return; // high bit of the mask is implicitly on pmask |= 1 << 31; // render - const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8); } diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index 6a80d16ebb4..a91bbace350 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -31,20 +31,17 @@ #define EXTENDED_XOFFS { 0 } #define EXTENDED_YOFFS { 0 } -#define GFX_ELEMENT_DONT_FREE 1 /* gfxdata was not malloc()ed, so don't free it on exit */ - #define GFX_RAW 0x12345678 -/* 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. - xoffset[0] is an optional displacement (*8) from the beginning of the source data, while - yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8 - for consistency with the usual behaviour, but the bottom 3 bits are not used. - - This special mode can be used to save memory in games that require several different - handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both - 8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs). -*/ +// 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. +// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while +// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8 +// for consistency with the usual behaviour, but the bottom 3 bits are not used. + +// This special mode can be used to save memory in games that require several different +// handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both +// 8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs). enum { @@ -59,15 +56,15 @@ enum MACROS ***************************************************************************/ -/* these macros describe gfx_layouts in terms of fractions of a region */ -/* they can be used for total, planeoffset, xoffset, yoffset */ +// these macros describe gfx_layouts in terms of fractions of a region +// they can be used for total, planeoffset, xoffset, yoffset #define RGN_FRAC(num,den) (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23)) #define IS_FRAC(offset) ((offset) & 0x80000000) #define FRAC_NUM(offset) (((offset) >> 27) & 0x0f) #define FRAC_DEN(offset) (((offset) >> 23) & 0x0f) #define FRAC_OFFSET(offset) ((offset) & 0x007fffff) -/* these macros are useful in gfx_layouts */ +// these macros are useful in gfx_layouts #define STEP2(START,STEP) (START),(START)+(STEP) #define STEP4(START,STEP) STEP2(START,STEP),STEP2((START)+2*(STEP),STEP) #define STEP8(START,STEP) STEP4(START,STEP),STEP4((START)+4*(STEP),STEP) @@ -81,7 +78,7 @@ enum #define STEP2048(START,STEP) STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP) -/* these macros are used for declaring gfx_decode_entry_entry info arrays. */ +// these macros are used for declaring gfx_decode_entry_entry info arrays. #define GFXDECODE_NAME( name ) gfxdecodeinfo_##name #define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[] #define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = { @@ -89,7 +86,7 @@ enum #define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale }, #define GFXDECODE_END { 0 } }; -/* these macros are used for declaring gfx_layout structures. */ +// these macros are used for declaring gfx_layout structures. #define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \ const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod }; @@ -99,70 +96,123 @@ const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { TYPE DEFINITIONS ***************************************************************************/ -typedef struct _gfx_layout gfx_layout; -struct _gfx_layout +struct gfx_layout { - UINT16 width; /* pixel width of each element */ - UINT16 height; /* pixel height of each element */ - UINT32 total; /* total number of elements, or RGN_FRAC() */ - UINT16 planes; /* number of bitplanes */ - UINT32 planeoffset[MAX_GFX_PLANES]; /* bit offset of each bitplane */ - UINT32 xoffset[MAX_GFX_SIZE]; /* bit offset of each horizontal pixel */ - UINT32 yoffset[MAX_GFX_SIZE]; /* bit offset of each vertical pixel */ - UINT32 charincrement; /* distance between two consecutive elements (in bits) */ - const UINT32 * extxoffs; /* extended X offset array for really big layouts */ - const UINT32 * extyoffs; /* extended Y offset array for really big layouts */ + UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; } + UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; } + + UINT16 width; // pixel width of each element + UINT16 height; // pixel height of each element + UINT32 total; // total number of elements, or RGN_FRAC() + UINT16 planes; // number of bitplanes + UINT32 planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane + UINT32 xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel + UINT32 yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel + UINT32 charincrement; // distance between two consecutive elements (in bits) + const UINT32 * extxoffs; // extended X offset array for really big layouts + const UINT32 * extyoffs; // extended Y offset array for really big layouts }; class gfx_element { public: - gfx_element(running_machine &machine) - : m_machine(machine) { } + // construction/destruction + gfx_element(running_machine &machine); + gfx_element(running_machine &machine, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base); + gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity); + // getters running_machine &machine() const { return m_machine; } - - UINT16 width; /* current pixel width of each element (changeble with source clipping) */ - UINT16 height; /* current pixel height of each element (changeble with source clipping) */ - UINT16 startx; /* current source clip X offset */ - UINT16 starty; /* current source clip Y offset */ - - UINT16 origwidth; /* starting pixel width of each element */ - UINT16 origheight; /* staring pixel height of each element */ - UINT8 flags; /* one of the GFX_ELEMENT_* flags above */ - UINT32 total_elements; /* total number of decoded elements */ - - UINT32 color_base; /* base color for rendering */ - UINT16 color_depth; /* number of colors each pixel can represent */ - UINT16 color_granularity; /* number of colors for each color code */ - UINT32 total_colors; /* number of color codes */ - - UINT32 * pen_usage; /* bitmask of pens that are used (pens 0-31 only) */ - - UINT8 * gfxdata; /* pixel data, 8bpp */ - UINT32 line_modulo; /* bytes between each row of data */ - UINT32 char_modulo; /* bytes between each element */ - const UINT8 * srcdata; /* pointer to the source data for decoding */ - UINT8 * dirty; /* dirty array for detecting tiles that need decoding */ - UINT32 dirtyseq; /* sequence number; incremented each time a tile is dirtied */ - - gfx_layout layout; /* copy of the original layout */ - + UINT16 width() const { return m_width; } + UINT16 height() const { return m_height; } + UINT32 elements() const { return m_total_elements; } + UINT32 colorbase() const { return m_color_base; } + UINT16 depth() const { return m_color_depth; } + UINT16 granularity() const { return m_color_granularity; } + UINT32 colors() const { return m_total_colors; } + UINT32 rowbytes() const { return m_line_modulo; } + bool has_pen_usage() const { return (m_pen_usage.count() > 0); } + + // a bit gross that people muck with this stuff... + const UINT8 *srcdata() const { return m_srcdata; } + UINT32 dirtyseq() const { return m_dirtyseq; } + UINT32 *pen_usage() { return &m_pen_usage[0]; } + + // setters + void set_layout(const gfx_layout &gl, const UINT8 *srcdata); + void set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 height, UINT32 total, UINT32 linemod, UINT32 charmod); + void set_source(const UINT8 *source) { m_srcdata = source; if (m_layout_is_raw) m_gfxdata = const_cast<UINT8 *>(source); memset(m_dirty, 1, elements()); } + void set_colors(UINT32 colors) { m_total_colors = colors; } + void set_colorbase(UINT16 colorbase) { m_color_base = colorbase; } + void set_granularity(UINT16 granularity) { m_color_granularity = granularity; } + void set_source_clip(UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height); + + // operations + void mark_dirty(UINT32 code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } } + void mark_all_dirty() { memset(&m_dirty[0], 1, elements()); } + void decode(UINT32 code); + + const UINT8 *get_data(UINT32 code) + { + assert(code < elements()); + if (m_dirty[code]) decode(code); + return m_gfxdata + code * m_char_modulo + m_starty * m_line_modulo + m_startx; + } + + UINT32 pen_usage(UINT32 code) + { + assert(code < m_pen_usage.count()); + if (m_dirty[code]) decode(code); + return m_pen_usage[code]; + } + private: - running_machine &m_machine; /* pointer to the owning machine */ + // internal state + UINT16 m_width; // current pixel width of each element (changeble with source clipping) + UINT16 m_height; // current pixel height of each element (changeble with source clipping) + UINT16 m_startx; // current source clip X offset + UINT16 m_starty; // current source clip Y offset + + UINT16 m_origwidth; // starting pixel width of each element + UINT16 m_origheight; // staring pixel height of each element + UINT32 m_total_elements; // total number of decoded elements + + UINT32 m_color_base; // base color for rendering + UINT16 m_color_depth; // number of colors each pixel can represent + UINT16 m_color_granularity; // number of colors for each color code + UINT32 m_total_colors; // number of color codes + + UINT32 m_line_modulo; // bytes between each row of data + UINT32 m_char_modulo; // bytes between each element + const UINT8 * m_srcdata; // pointer to the source data for decoding + UINT32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied + + UINT8 * m_gfxdata; // pointer to decoded pixel data, 8bpp + dynamic_buffer m_gfxdata_allocated; // allocated decoded pixel data, 8bpp + dynamic_buffer m_dirty; // dirty array for detecting chars that need decoding + dynamic_array<UINT32> m_pen_usage; // bitmask of pens that are used (pens 0-31 only) + + bool m_layout_is_raw; // raw layout? + UINT8 m_layout_planes; // bit planes in the layout + UINT32 m_layout_charincrement; // per-character increment in source data + dynamic_array<UINT32> m_layout_planeoffset;// plane offsets + dynamic_array<UINT32> m_layout_xoffset; // X offsets + dynamic_array<UINT32> m_layout_yoffset; // Y offsets + + running_machine &m_machine; // pointer to the owning machine }; struct gfx_decode_entry { - const char * memory_region; /* memory region where the data resides */ - UINT32 start; /* offset of beginning of data to decode */ - const gfx_layout *gfxlayout; /* pointer to gfx_layout describing the layout; NULL marks the end of the array */ - UINT16 color_codes_start; /* offset in the color lookup table where color codes start */ - UINT16 total_color_codes; /* total number of color codes */ - UINT8 xscale; /* optional horizontal scaling factor; 0 means 1x */ - UINT8 yscale; /* optional vertical scaling factor; 0 means 1x */ + const char * memory_region; // memory region where the data resides + UINT32 start; // offset of beginning of data to decode + const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; NULL marks the end of the array + UINT16 color_codes_start; // offset in the color lookup table where color codes start + UINT16 total_color_codes; // total number of color codes + UINT8 xscale; // optional horizontal scaling factor; 0 means 1x + UINT8 yscale; // optional vertical scaling factor; 0 means 1x }; @@ -172,132 +222,120 @@ struct gfx_decode_entry ***************************************************************************/ -/* ----- graphics elements ----- */ +// ----- graphics elements ----- -/* allocate memory for the graphics elements referenced by a machine */ +// allocate memory for the graphics elements referenced by a machine void gfx_init(running_machine &machine); -/* allocate a gfx_element structure based on a given layout */ -gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base); - -/* update a single code in a gfx_element */ -void gfx_element_decode(const gfx_element *gfx, UINT32 code); -/* free a gfx_element */ -void gfx_element_free(gfx_element *gfx); -/* create a temporary one-off gfx_element */ -void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags); +// ----- core graphics drawing ----- +// specific drawgfx implementations for each transparency type +void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); +void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); +void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); +void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); +void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); +void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); +void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask); +void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask); +void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable); +void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable); +void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha); -/* ----- core graphics drawing ----- */ -/* specific drawgfx implementations for each transparency type */ -void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); -void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); -void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); -void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); -void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); -void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); -void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask); -void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask); -void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable); -void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable); -void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha); +// ----- zoomed graphics drawing ----- +// specific drawgfxzoom implementations for each transparency type +void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley); +void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley); +void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); +void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); +void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); +void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); +void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask); +void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask); +void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable); +void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable); +void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha); -/* ----- zoomed graphics drawing ----- */ -/* specific drawgfxzoom implementations for each transparency type */ -void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley); -void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley); -void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); -void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); -void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); -void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); -void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask); -void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask); -void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable); -void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable); -void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha); +// ----- priority masked graphics drawing ----- +// specific pdrawgfx implementations for each transparency type +void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask); +void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask); +void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); +void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); +void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); +void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); +void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); -/* ----- priority masked graphics drawing ----- */ -/* specific pdrawgfx implementations for each transparency type */ -void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask); -void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask); -void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); -void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); -void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); -void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); -void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); +// ----- priority masked zoomed graphics drawing ----- +// specific pdrawgfxzoom implementations for each transparency type +void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask); +void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask); +void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); +void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); +void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); +void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); +void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); +void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); -/* ----- priority masked zoomed graphics drawing ----- */ -/* specific pdrawgfxzoom implementations for each transparency type */ -void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask); -void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask); -void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen); -void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); -void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask); -void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); -void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); -void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); +// ----- scanline copying ----- - - -/* ----- scanline copying ----- */ - -/* copy pixels from an 8bpp buffer to a single scanline of a bitmap */ +// copy pixels from an 8bpp buffer to a single scanline of a bitmap void draw_scanline8(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata); void draw_scanline8(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata); -/* copy pixels from a 16bpp buffer to a single scanline of a bitmap */ +// copy pixels from a 16bpp buffer to a single scanline of a bitmap void draw_scanline16(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata); void draw_scanline16(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata); -/* copy pixels from a 32bpp buffer to a single scanline of a bitmap */ +// copy pixels from a 32bpp buffer to a single scanline of a bitmap void draw_scanline32(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata); void draw_scanline32(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata); -/* ----- scanline extraction ----- */ +// ----- scanline extraction ----- -/* copy pixels from a single scanline of a bitmap to an 8bpp buffer */ +// copy pixels from a single scanline of a bitmap to an 8bpp buffer void extract_scanline8(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr); void extract_scanline8(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr); -/* copy pixels from a single scanline of a bitmap to a 16bpp buffer */ +// copy pixels from a single scanline of a bitmap to a 16bpp buffer void extract_scanline16(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr); void extract_scanline16(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr); -/* copy pixels from a single scanline of a bitmap to a 32bpp buffer */ +// copy pixels from a single scanline of a bitmap to a 32bpp buffer void extract_scanline32(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr); void extract_scanline32(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr); -/* ----- bitmap copying ----- */ +// ----- bitmap copying ----- -/* copy from one bitmap to another, copying all unclipped pixels */ +// copy from one bitmap to another, copying all unclipped pixels void copybitmap(bitmap_ind16 &dest, bitmap_ind16 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect); void copybitmap(bitmap_rgb32 &dest, bitmap_rgb32 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect); -/* copy from one bitmap to another, copying all unclipped pixels except those that match transpen */ +// copy from one bitmap to another, copying all unclipped pixels except those that match transpen void copybitmap_trans(bitmap_ind16 &dest, bitmap_ind16 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect, UINT32 transpen); void copybitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect, UINT32 transpen); @@ -313,11 +351,11 @@ void copybitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, int flipx, int flip scrolls as a whole in at least one direction. */ -/* copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/columns */ +// copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/columns void copyscrollbitmap(bitmap_ind16 &dest, bitmap_ind16 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect); void copyscrollbitmap(bitmap_rgb32 &dest, bitmap_rgb32 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect); -/* copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns */ +// copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns void copyscrollbitmap_trans(bitmap_ind16 &dest, bitmap_ind16 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect, UINT32 transpen); void copyscrollbitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect, UINT32 transpen); @@ -350,11 +388,11 @@ void copyscrollbitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, UINT32 numrow copy. This is obtained by setting the wraparound parameter to true. */ -/* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels */ +// copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, bitmap_ind16 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound); void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_rgb32 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound); -/* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen */ +// copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, bitmap_ind16 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transparent_color); void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_rgb32 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transparent_color); @@ -364,73 +402,12 @@ void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_r INLINE FUNCTIONS ***************************************************************************/ -/*------------------------------------------------- - gfx_element_set_source - set a pointer to - the source of a gfx_element --------------------------------------------------*/ - -INLINE void gfx_element_set_source(gfx_element *gfx, const UINT8 *source) -{ - gfx->srcdata = source; - memset(gfx->dirty, 1, gfx->total_elements); -} - - -/*------------------------------------------------- - gfx_element_get_data - return a pointer to - the base of the given code within a - gfx_element, decoding it if it is dirty --------------------------------------------------*/ - -INLINE const UINT8 *gfx_element_get_data(const gfx_element *gfx, UINT32 code) -{ - assert(code < gfx->total_elements); - if (gfx->dirty[code]) - gfx_element_decode(gfx, code); - return gfx->gfxdata + code * gfx->char_modulo + gfx->starty * gfx->line_modulo + gfx->startx; -} - - -/*------------------------------------------------- - gfx_element_mark_dirty - mark a code of a - gfx_element dirty --------------------------------------------------*/ - -INLINE void gfx_element_mark_dirty(gfx_element *gfx, UINT32 code) -{ - if (code < gfx->total_elements) - { - gfx->dirty[code] = 1; - gfx->dirtyseq++; - } -} - - -/*------------------------------------------------- - gfx_element_set_source_clip - set a source - clipping area to apply to subsequent renders --------------------------------------------------*/ - -INLINE void gfx_element_set_source_clip(gfx_element *gfx, UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height) -{ - assert(xoffs < gfx->origwidth); - assert(yoffs < gfx->origheight); - assert(xoffs + width <= gfx->origwidth); - assert(yoffs + height <= gfx->origheight); - - gfx->width = width; - gfx->height = height; - gfx->startx = xoffs; - gfx->starty = yoffs; -} - - -/*------------------------------------------------- - alpha_blend_r16 - alpha blend two 16-bit - 5-5-5 RGB pixels --------------------------------------------------*/ +//------------------------------------------------- +// alpha_blend_r16 - alpha blend two 16-bit +// 5-5-5 RGB pixels +//------------------------------------------------- -INLINE UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level) +inline UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level) { int alphad = 256 - level; return ((((s & 0x001f) * level + (d & 0x001f) * alphad) >> 8)) | @@ -439,12 +416,12 @@ INLINE UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level) } -/*------------------------------------------------- - alpha_blend_r32 - alpha blend two 32-bit - 8-8-8 RGB pixels --------------------------------------------------*/ +//------------------------------------------------- +// alpha_blend_r16 - alpha blend two 32-bit +// 8-8-8 RGB pixels +//------------------------------------------------- -INLINE UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level) +inline UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level) { int alphad = 256 - level; return ((((s & 0x0000ff) * level + (d & 0x0000ff) * alphad) >> 8)) | @@ -453,4 +430,4 @@ INLINE UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level) } -#endif /* __DRAWGFX_H__ */ +#endif // __DRAWGFX_H__ diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index a6e68c6b133..bd16e4e96c2 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -338,7 +338,7 @@ while (0) \ bitmap_t &dest - the bitmap to render to const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - const gfx_element *gfx - pointer to the gfx_element to render + gfx_element *gfx - pointer to the gfx_element to render UINT32 code - index of the entry within gfx_element UINT32 color - index of the color within gfx_element int flipx - non-zero means render right-to-left instead of left-to-right @@ -363,14 +363,14 @@ do { \ assert(gfx != NULL); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ assert(dest.cliprect().contains(cliprect)); \ - assert(code < gfx->total_elements); \ + assert(code < gfx->elements()); \ \ /* ignore empty/invalid cliprects */ \ if (cliprect.empty()) \ break; \ \ /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + gfx->width - 1; \ + destendx = destx + gfx->width() - 1; \ if (destx > cliprect.max_x || destendx < cliprect.min_x) \ break; \ \ @@ -387,7 +387,7 @@ do { \ destendx = cliprect.max_x; \ \ /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + gfx->height - 1; \ + destendy = desty + gfx->height() - 1; \ if (desty > cliprect.max_y || destendy < cliprect.min_y) \ break; \ \ @@ -405,25 +405,25 @@ do { \ \ /* apply X flipping */ \ if (flipx) \ - srcx = gfx->width - 1 - srcx; \ + srcx = gfx->width() - 1 - srcx; \ \ /* apply Y flipping */ \ - dy = gfx->line_modulo; \ + dy = gfx->rowbytes(); \ if (flipy) \ { \ - srcy = gfx->height - 1 - srcy; \ + srcy = gfx->height() - 1 - srcy; \ dy = -dy; \ } \ \ /* fetch the source data */ \ - srcdata = gfx_element_get_data(gfx, code); \ + srcdata = gfx->get_data(code); \ \ /* compute how many blocks of 4 pixels we have */ \ UINT32 numblocks = (destendx + 1 - destx) / 4; \ UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ /* adjust srcdata to point to the first source pixel of the row */ \ - srcdata += srcy * gfx->line_modulo + srcx; \ + srcdata += srcy * gfx->rowbytes() + srcx; \ \ /* non-flipped 8bpp case */ \ if (!flipx) \ @@ -509,7 +509,7 @@ do { \ bitmap_t &dest - the bitmap to render to const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - const gfx_element *gfx - pointer to the gfx_element to render + gfx_element *gfx - pointer to the gfx_element to render UINT32 code - index of the entry within gfx_element UINT32 color - index of the color within gfx_element int flipx - non-zero means render right-to-left instead of left-to-right @@ -543,14 +543,14 @@ do { \ break; \ \ /* compute scaled size */ \ - dstwidth = (scalex * gfx->width + 0x8000) >> 16; \ - dstheight = (scaley * gfx->height + 0x8000) >> 16; \ + dstwidth = (scalex * gfx->width() + 0x8000) >> 16; \ + dstheight = (scaley * gfx->height() + 0x8000) >> 16; \ if (dstwidth < 1 || dstheight < 1) \ break; \ \ /* compute 16.16 source steps in dx and dy */ \ - dx = (gfx->width << 16) / dstwidth; \ - dy = (gfx->height << 16) / dstheight; \ + dx = (gfx->width() << 16) / dstwidth; \ + dy = (gfx->height() << 16) / dstheight; \ \ /* compute final pixel in X and exit if we are entirely clipped */ \ destendx = destx + dstwidth - 1; \ @@ -604,7 +604,7 @@ do { \ } \ \ /* fetch the source data */ \ - srcdata = gfx_element_get_data(gfx, code); \ + srcdata = gfx->get_data(code); \ \ /* compute how many blocks of 4 pixels we have */ \ UINT32 numblocks = (destendx + 1 - destx) / 4; \ @@ -615,7 +615,7 @@ do { \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->line_modulo; \ + const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->rowbytes(); \ INT32 cursrcx = srcx; \ srcy += dy; \ \ diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 30677d81ee7..99a20b9b61b 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -434,19 +434,19 @@ rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry) color -------------------------------------------------*/ -UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor) +UINT32 colortable_get_transpen_mask(colortable_t *ctable, gfx_element *gfx, int color, int transcolor) { - UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity; + UINT32 entry = gfx->colorbase() + (color % gfx->colors()) * gfx->granularity(); UINT32 mask = 0; UINT32 count, bit; /* make sure we are in range */ assert(ctable != NULL); assert(entry < ctable->entries); - assert(gfx->color_depth <= 32); + assert(gfx->depth() <= 32); /* either gfx->color_depth entries or as many as we can get up until the end */ - count = MIN(gfx->color_depth, ctable->entries - entry); + count = MIN(gfx->depth(), ctable->entries - entry); /* set a bit anywhere the transcolor matches */ for (bit = 0; bit < count; bit++) @@ -465,17 +465,17 @@ UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx (each group maps to a gfx color) -------------------------------------------------*/ -void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, const gfx_element *gfx, int transcolor) +void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, gfx_element *gfx, int transcolor) { int color; assert(ctable != NULL); assert(gfx != NULL); assert(tmap != NULL); - assert(gfx->total_colors <= TILEMAP_NUM_GROUPS); + assert(gfx->colors() <= TILEMAP_NUM_GROUPS); /* iterate over all colors in the tilemap */ - for (color = 0; color < gfx->total_colors; color++) + for (color = 0; color < gfx->colors(); color++) tmap->set_transmask(color, colortable_get_transpen_mask(ctable, gfx, color, transcolor), 0); } diff --git a/src/emu/emupal.h b/src/emu/emupal.h index 1180cfdb25a..27377f57dac 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -166,10 +166,10 @@ void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t colo rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry); /* return a 32-bit transparency mask for a given gfx element and color */ -UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor); +UINT32 colortable_get_transpen_mask(colortable_t *ctable, gfx_element *gfx, int color, int transcolor); /* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */ -void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, const gfx_element *gfx, int transcolor); +void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, gfx_element *gfx, int transcolor); /* return the number of entries in a colortable */ UINT32 colortable_palette_get_size(colortable_t *ctable); diff --git a/src/emu/machine/tc009xlvc.c b/src/emu/machine/tc009xlvc.c index e297988cccf..76be7b7169c 100644 --- a/src/emu/machine/tc009xlvc.c +++ b/src/emu/machine/tc009xlvc.c @@ -83,7 +83,7 @@ READ8_MEMBER(tc0091lvc_device::tc0091lvc_pcg1_r) WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_pcg1_w) { m_pcg1_ram[offset] = data; - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x4000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0x4000) / 32); tx_tilemap->mark_all_dirty(); } @@ -95,7 +95,7 @@ READ8_MEMBER(tc0091lvc_device::tc0091lvc_pcg2_r) WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_pcg2_w) { m_pcg2_ram[offset] = data; - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xc000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0xc000) / 32); tx_tilemap->mark_all_dirty(); } @@ -108,7 +108,7 @@ WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_vram0_w) { m_vram0[offset] = data; bg0_tilemap->mark_tile_dirty(offset/2); - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x8000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0x8000) / 32); tx_tilemap->mark_all_dirty(); } @@ -122,7 +122,7 @@ WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_vram1_w) { m_vram1[offset] = data; bg1_tilemap->mark_tile_dirty(offset/2); - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x9000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0x9000) / 32); tx_tilemap->mark_all_dirty(); } @@ -135,7 +135,7 @@ WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_tvram_w) { m_tvram[offset] = data; tx_tilemap->mark_tile_dirty(offset/2); - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xa000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0xa000) / 32); tx_tilemap->mark_all_dirty(); } @@ -147,7 +147,7 @@ READ8_MEMBER(tc0091lvc_device::tc0091lvc_spr_r) WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_spr_w) { m_sprram[offset] = data; - gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xb000) / 32); + machine().gfx[m_gfx_index]->mark_dirty((offset+0xb000) / 32); tx_tilemap->mark_all_dirty(); } @@ -276,7 +276,7 @@ void tc0091lvc_device::device_start() //printf("m_gfx_index %d\n", m_gfx_index); - machine().gfx[m_gfx_index] = gfx_element_alloc(machine(), &char_layout, (UINT8 *)m_pcg_ram, machine().total_colors() / 16, 0); + machine().gfx[m_gfx_index] = auto_alloc(machine(), gfx_element(machine(), char_layout, (UINT8 *)m_pcg_ram, machine().total_colors() / 16, 0)); } void tc0091lvc_device::device_reset() @@ -292,7 +292,7 @@ const address_space_config *tc0091lvc_device::memory_space_config(address_spacen void tc0091lvc_device::draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 global_flip ) { - const gfx_element *gfx = machine.gfx[1]; + gfx_element *gfx = machine.gfx[1]; int count; for(count=0;count<0x3e7;count+=8) diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index 10367147112..990ad5338c1 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -114,9 +114,9 @@ inline bool tilemap_t::gfx_elements_changed() // iterate over all used gfx types and set the dirty flag if any of them have changed for (int gfxnum = 0; usedmask != 0; usedmask >>= 1, gfxnum++) if ((usedmask & 1) != 0) - if (m_gfx_dirtyseq[gfxnum] != machine().gfx[gfxnum]->dirtyseq) + if (m_gfx_dirtyseq[gfxnum] != machine().gfx[gfxnum]->dirtyseq()) { - m_gfx_dirtyseq[gfxnum] = machine().gfx[gfxnum]->dirtyseq; + m_gfx_dirtyseq[gfxnum] = machine().gfx[gfxnum]->dirtyseq(); isdirty = true; } @@ -756,7 +756,7 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE); if (m_tileinfo.gfxnum != 0xff && (m_gfx_used & (1 << m_tileinfo.gfxnum)) == 0) { m_gfx_used |= 1 << m_tileinfo.gfxnum; - m_gfx_dirtyseq[m_tileinfo.gfxnum] = machine().gfx[m_tileinfo.gfxnum]->dirtyseq; + m_gfx_dirtyseq[m_tileinfo.gfxnum] = machine().gfx[m_tileinfo.gfxnum]->dirtyseq(); } g_profiler.stop(); diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h index d5e98acaccb..120d6b9bf7d 100644 --- a/src/emu/tilemap.h +++ b/src/emu/tilemap.h @@ -408,19 +408,19 @@ struct tile_data void set(running_machine &machine, int _gfxnum, int rawcode, int rawcolor, int _flags) { - const gfx_element *gfx = machine.gfx[_gfxnum]; - int code = rawcode % gfx->total_elements; - pen_data = gfx_element_get_data(gfx, code); - palette_base = gfx->color_base + gfx->color_granularity * rawcolor; + gfx_element *gfx = machine.gfx[_gfxnum]; + int code = rawcode % gfx->elements(); + pen_data = gfx->get_data(code); + palette_base = gfx->colorbase() + gfx->granularity() * rawcolor; flags = _flags; gfxnum = _gfxnum; } - void set(running_machine &machine, const gfx_element &gfx, int rawcode, int rawcolor, int _flags) + void set(running_machine &machine, gfx_element &gfx, int rawcode, int rawcolor, int _flags) { - int code = rawcode % gfx.total_elements; - pen_data = gfx_element_get_data(&gfx, code); - palette_base = gfx.color_base + gfx.color_granularity * rawcolor; + int code = rawcode % gfx.elements(); + pen_data = gfx.get_data(code); + palette_base = gfx.colorbase() + gfx.granularity() * rawcolor; flags = _flags; } }; diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index 87f8d75ecae..eb9ca5ff44a 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -84,7 +84,7 @@ static void palette_handler(running_machine &machine, render_container *containe /* graphics set handling */ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, int xcells, int ycells); -static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate); +static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate); static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx); static void gfxset_handler(running_machine &machine, render_container *container, ui_gfx_state *state); @@ -473,8 +473,8 @@ static void gfxset_handler(running_machine &machine, render_container *container cellboxheight = (cellboxbounds.y1 - cellboxbounds.y0) * (float)targheight; /* compute the number of source pixels in a cell */ - cellxpix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width); - cellypix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height); + cellxpix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width()); + cellypix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height()); /* compute the largest pixel scale factor that still fits */ xcells = state->gfxset.count[set]; @@ -513,7 +513,7 @@ static void gfxset_handler(running_machine &machine, render_container *container /* figure out the title and expand the outer box to fit */ for (x = 0; x < MAX_GFX_ELEMENTS && machine.gfx[x] != NULL; x++) ; - sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]); + sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width(), gfx->height(), state->gfxset.color[set]); titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); x0 = 0.0f; if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) @@ -550,7 +550,7 @@ static void gfxset_handler(running_machine &machine, render_container *container for (y = 0; y < ycells; y += 1 + skip) /* only display if there is data to show */ - if (state->gfxset.offset[set] + y * xcells < gfx->total_elements) + if (state->gfxset.offset[set] + y * xcells < gfx->elements()) { char buffer[10]; @@ -645,11 +645,11 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, in if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4)) state->gfxset.offset[set] = 0; if (ui_input_pressed_repeat(machine, IPT_UI_END, 4)) - state->gfxset.offset[set] = gfx->total_elements; + state->gfxset.offset[set] = gfx->elements(); /* clamp within range */ - if (state->gfxset.offset[set] + xcells * ycells > ((gfx->total_elements + xcells - 1) / xcells) * xcells) - state->gfxset.offset[set] = ((gfx->total_elements + xcells - 1) / xcells) * xcells - xcells * ycells; + if (state->gfxset.offset[set] + xcells * ycells > ((gfx->elements() + xcells - 1) / xcells) * xcells) + state->gfxset.offset[set] = ((gfx->elements() + xcells - 1) / xcells) * xcells - xcells * ycells; if (state->gfxset.offset[set] < 0) state->gfxset.offset[set] = 0; @@ -660,8 +660,8 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, in state->gfxset.color[set] += 1; /* clamp within range */ - if (state->gfxset.color[set] >= (int)gfx->total_colors) - state->gfxset.color[set] = gfx->total_colors - 1; + if (state->gfxset.color[set] >= (int)gfx->colors()) + state->gfxset.color[set] = gfx->colors() - 1; if (state->gfxset.color[set] < 0) state->gfxset.color[set] = 0; @@ -689,8 +689,8 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, int x, y; /* compute the number of source pixels in a cell */ - cellxpix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width); - cellypix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height); + cellxpix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width()); + cellypix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height()); /* realloc the bitmap if it is too small */ if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp() != 32 || state->bitmap->width() != cellxpix * xcells || state->bitmap->height() != cellypix * ycells) @@ -720,7 +720,7 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, cellbounds.set(0, state->bitmap->width() - 1, y * cellypix, (y + 1) * cellypix - 1); /* only display if there is data to show */ - if (state->gfxset.offset[set] + y * xcells < gfx->total_elements) + if (state->gfxset.offset[set] + y * xcells < gfx->elements()) { /* draw the individual cells */ for (x = 0; x < xcells; x++) @@ -732,7 +732,7 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, cellbounds.max_x = (x + 1) * cellxpix - 1; /* only render if there is data */ - if (index < gfx->total_elements) + if (index < gfx->elements()) gfxset_draw_item(machine, gfx, index, *state->bitmap, cellbounds.min_x, cellbounds.min_y, state->gfxset.color[set], state->gfxset.rotate[set]); /* otherwise, fill with transparency */ @@ -758,21 +758,21 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, the view -------------------------------------------------*/ -static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate) +static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255), MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255) }; - int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; - int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; + int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width(); + int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height(); const rgb_t *palette = (machine.total_colors() != 0) ? palette_entry_list_raw(machine.palette) : NULL; UINT32 palette_mask = ~0; int x, y; if (palette != NULL) - palette += gfx->color_base + color * gfx->color_granularity; + palette += gfx->colorbase() + color * gfx->granularity(); else { palette = default_palette; @@ -783,7 +783,7 @@ static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, i for (y = 0; y < height; y++) { UINT32 *dest = &bitmap.pix32(dsty + y, dstx); - const UINT8 *src = gfx_element_get_data(gfx, index); + const UINT8 *src = gfx->get_data(index); /* loop over columns in the cell */ for (x = 0; x < width; x++) @@ -795,22 +795,22 @@ static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, i if (!(rotate & ORIENTATION_SWAP_XY)) { if (rotate & ORIENTATION_FLIP_X) - effx = gfx->width - 1 - effx; + effx = gfx->width() - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) - effy = gfx->height - 1 - effy; + effy = gfx->height() - 1 - effy; } else { int temp; if (rotate & ORIENTATION_FLIP_X) - effx = gfx->height - 1 - effx; + effx = gfx->height() - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) - effy = gfx->width - 1 - effy; + effy = gfx->width() - 1 - effy; temp = effx; effx = effy; effy = temp; } /* get a pointer to the start of this source row */ - s = src + effy * gfx->line_modulo; + s = src + effy * gfx->rowbytes(); /* extract the pixel */ *dest++ = 0xff000000 | palette[s[effx] & palette_mask]; diff --git a/src/emu/video.c b/src/emu/video.c index a4f9d066401..ae981db46ad 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -528,7 +528,7 @@ void video_manager::exit() // free all the graphics elements for (int i = 0; i < MAX_GFX_ELEMENTS; i++) - gfx_element_free(machine().gfx[i]); + auto_free(machine(), machine().gfx[i]); // free the snapshot target machine().render().target_free(m_snap_target); |