diff options
Diffstat (limited to 'src/emu/drawgfx.cpp')
-rw-r--r-- | src/emu/drawgfx.cpp | 113 |
1 files changed, 56 insertions, 57 deletions
diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp index fe909496342..d7648483f21 100644 --- a/src/emu/drawgfx.cpp +++ b/src/emu/drawgfx.cpp @@ -2,9 +2,10 @@ // copyright-holders:Nicola Salmoria, Aaron Giles /********************************************************************* - drawgfx.c + drawgfx.cpp Generic graphic functions. + *********************************************************************/ #include "emu.h" @@ -20,7 +21,7 @@ offset -------------------------------------------------*/ -static inline int readbit(const u8 *src, unsigned int bitnum) +constexpr int readbit(const u8 *src, unsigned int bitnum) { return src[bitnum / 8] & (0x80 >> (bitnum % 8)); } @@ -65,63 +66,61 @@ gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *ta - /*************************************************************************** GRAPHICS ELEMENTS ***************************************************************************/ - //------------------------------------------------- // gfx_element - constructor //------------------------------------------------- -gfx_element::gfx_element(device_palette_interface *palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity) - : m_palette(palette), - m_width(width), - m_height(height), - m_startx(0), - m_starty(0), - m_origwidth(width), - m_origheight(height), - m_total_elements(1), - m_color_base(color_base), - m_color_depth(color_granularity), - m_color_granularity(color_granularity), - m_total_colors((total_colors - color_base) / color_granularity), - m_line_modulo(rowbytes), - m_char_modulo(0), - m_srcdata(base), - m_dirtyseq(1), - m_gfxdata(base), - m_layout_is_raw(true), - m_layout_planes(0), - m_layout_xormask(0), - m_layout_charincrement(0) -{ -} - -gfx_element::gfx_element(device_palette_interface *palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base) - : m_palette(palette), - m_width(0), - m_height(0), - m_startx(0), - m_starty(0), - m_origwidth(0), - m_origheight(0), - m_total_elements(0), - m_color_base(color_base), - m_color_depth(0), - m_color_granularity(0), - m_total_colors(total_colors), - m_line_modulo(0), - m_char_modulo(0), - m_srcdata(nullptr), - m_dirtyseq(1), - m_gfxdata(nullptr), - m_layout_is_raw(false), - m_layout_planes(0), - m_layout_xormask(xormask), - m_layout_charincrement(0) +gfx_element::gfx_element(device_palette_interface *palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity) : + m_palette(palette), + m_width(width), + m_height(height), + m_startx(0), + m_starty(0), + m_origwidth(width), + m_origheight(height), + m_total_elements(1), + m_color_base(color_base), + m_color_depth(color_granularity), + m_color_granularity(color_granularity), + m_total_colors((total_colors - color_base) / color_granularity), + m_line_modulo(rowbytes), + m_char_modulo(0), + m_srcdata(base), + m_dirtyseq(1), + m_gfxdata(base), + m_layout_is_raw(true), + m_layout_planes(0), + m_layout_xormask(0), + m_layout_charincrement(0) +{ +} + +gfx_element::gfx_element(device_palette_interface *palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base) : + m_palette(palette), + m_width(0), + m_height(0), + m_startx(0), + m_starty(0), + m_origwidth(0), + m_origheight(0), + m_total_elements(0), + m_color_base(color_base), + m_color_depth(0), + m_color_granularity(0), + m_total_colors(total_colors), + m_line_modulo(0), + m_char_modulo(0), + m_srcdata(nullptr), + m_dirtyseq(1), + m_gfxdata(nullptr), + m_layout_is_raw(false), + m_layout_planes(0), + m_layout_xormask(xormask), + m_layout_charincrement(0) { // set the layout set_layout(gl, srcdata); @@ -2132,8 +2131,8 @@ void primask_copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 n scrolling to one or more rows/columns -------------------------------------------------*/ -template<class _BitmapClass> -static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) +template<class BitmapClass> +static inline void copyscrollbitmap_trans_common(BitmapClass &dest, const BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) { // no rowscroll and no colscroll means no scroll if (numrows == 0 && numcols == 0) @@ -2235,8 +2234,8 @@ void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 num void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) { copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen); } -template<class _BitmapClass> -static inline void prio_copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) +template<class BitmapClass> +static inline void prio_copyscrollbitmap_trans_common(BitmapClass &dest, const BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // no rowscroll and no colscroll means no scroll if (numrows == 0 && numcols == 0) @@ -2338,8 +2337,8 @@ void prio_copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u3 void prio_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { prio_copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, priority, pmask, trans_pen); } -template<class _BitmapClass> -static inline void primask_copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff) +template<class BitmapClass> +static inline void primask_copyscrollbitmap_trans_common(BitmapClass &dest, const BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff) { // no rowscroll and no colscroll means no scroll if (pcode == 0 && pmask == 0xff) |