mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00
drawgfx.c: make it possible to reset the total elements of a gfx_element [Alex Jackson]
This commit is contained in:
parent
1a9ed9ebe8
commit
ffd0b5f2ad
@ -172,6 +172,8 @@ gfx_element::gfx_element(palette_device *palette, const gfx_layout &gl, const UI
|
|||||||
|
|
||||||
void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
|
void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
|
||||||
{
|
{
|
||||||
|
m_srcdata = srcdata;
|
||||||
|
|
||||||
// configure ourselves
|
// configure ourselves
|
||||||
m_width = m_origwidth = gl.width;
|
m_width = m_origwidth = gl.width;
|
||||||
m_height = m_origheight = gl.height;
|
m_height = m_origheight = gl.height;
|
||||||
@ -199,7 +201,7 @@ void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
|
|||||||
|
|
||||||
// RAW graphics must have a pointer up front
|
// RAW graphics must have a pointer up front
|
||||||
assert(srcdata != NULL);
|
assert(srcdata != NULL);
|
||||||
m_gfxdata = const_cast<UINT8 *>(m_srcdata);
|
m_gfxdata = const_cast<UINT8 *>(srcdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
// decoded graphics case
|
// decoded graphics case
|
||||||
@ -234,9 +236,6 @@ void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
|
|||||||
m_pen_usage.resize(m_total_elements);
|
m_pen_usage.resize(m_total_elements);
|
||||||
else
|
else
|
||||||
m_pen_usage.reset();
|
m_pen_usage.reset();
|
||||||
|
|
||||||
// set the source
|
|
||||||
set_source(srcdata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,6 +257,48 @@ void gfx_element::set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 heig
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// set_source - set the source data for a gfx_element
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void gfx_element::set_source(const UINT8 *source)
|
||||||
|
{
|
||||||
|
m_srcdata = source;
|
||||||
|
memset(m_dirty, 1, elements());
|
||||||
|
if (m_layout_is_raw) m_gfxdata = const_cast<UINT8 *>(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// set_source_and_total - set the source data
|
||||||
|
// and total elements for a gfx_element
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void gfx_element::set_source_and_total(const UINT8 *source, UINT32 total)
|
||||||
|
{
|
||||||
|
m_srcdata = source;
|
||||||
|
m_total_elements = total;
|
||||||
|
|
||||||
|
// mark everything dirty
|
||||||
|
m_dirty.resize_and_clear(m_total_elements, 1);
|
||||||
|
|
||||||
|
// allocate a pen usage array for entries with 32 pens or less
|
||||||
|
if (m_color_depth <= 32)
|
||||||
|
m_pen_usage.resize(m_total_elements);
|
||||||
|
|
||||||
|
if (m_layout_is_raw)
|
||||||
|
{
|
||||||
|
m_gfxdata = const_cast<UINT8 *>(source);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// allocate memory for the data
|
||||||
|
m_gfxdata_allocated.resize(m_total_elements * m_char_modulo);
|
||||||
|
m_gfxdata = &m_gfxdata_allocated[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// set_source_clip - set a source clipping rect
|
// set_source_clip - set a source clipping rect
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -62,7 +62,8 @@ public:
|
|||||||
// setters
|
// setters
|
||||||
void set_layout(const gfx_layout &gl, const UINT8 *srcdata);
|
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_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_source(const UINT8 *source);
|
||||||
|
void set_source_and_total(const UINT8 *source, UINT32 total);
|
||||||
void set_xormask(UINT32 xormask) { m_layout_xormask = xormask; }
|
void set_xormask(UINT32 xormask) { m_layout_xormask = xormask; }
|
||||||
void set_palette(palette_device *palette) { m_palette = palette; }
|
void set_palette(palette_device *palette) { m_palette = palette; }
|
||||||
void set_colors(UINT32 colors) { m_total_colors = colors; }
|
void set_colors(UINT32 colors) { m_total_colors = colors; }
|
||||||
|
Loading…
Reference in New Issue
Block a user