From a5e00faf88ec05d1705b9bc4796cc6f21f2cc7a9 Mon Sep 17 00:00:00 2001 From: cam900 Date: Thu, 18 Jul 2019 23:17:11 +0900 Subject: Allow 16bpp gfxdecode (#5167) * digfx.cpp : Add 16bpp case of RAW gfx layout drawgfx.cpp, tilemap.cpp : Make changeable total elements of gfx_elements constructor at RAW case, Allow 16bpp gfxdecode, Fix spacing tilemap.cpp : Allow 16bpp tilemap pen data gstream.cpp : Use gfxdecode for 16bpp gfx of X2222, Fix spacing igs017_igs031.cpp : Cleanup single sprite drawing routine jedi.cpp : Improve debug gfxdecode viewer(text gfx) * cps1.cpp : Minor fixes * gstream.cpp : Fix regression in x2222 drawgfx.cpp : Fix 16bpp transparent pen * gstream.cpp : Fix regression, Reduce unnecessary lines * Sync to master --- src/emu/drawgfx.h | 72 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'src/emu/drawgfx.h') diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index 4d3f4d0e0c9..16902a6c932 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -152,7 +152,7 @@ public: gfx_element(); #endif gfx_element(device_palette_interface *palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base); - gfx_element(device_palette_interface *palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity); + gfx_element(device_palette_interface *palette, const u8 *base, u32 total, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity); // getters device_palette_interface &palette() const { return *m_palette; } @@ -173,6 +173,7 @@ public: // setters void set_layout(const gfx_layout &gl, const u8 *srcdata); void set_raw_layout(const u8 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod); + void set_raw_layout(const u16 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod); void set_source(const u8 *source); void set_source_and_total(const u8 *source, u32 total); void set_xormask(u32 xormask) { m_layout_xormask = xormask; } @@ -186,7 +187,7 @@ public: void mark_dirty(u32 code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } } void mark_all_dirty() { memset(&m_dirty[0], 1, elements()); } - const u8 *get_data(u32 code) + const u16 *get_data(u32 code) { assert(code < elements()); if (code < m_dirty.size() && m_dirty[code]) decode(code); @@ -270,39 +271,40 @@ private: void decode(u32 code); // internal state - device_palette_interface *m_palette; // palette used for drawing (optional when used as a pure decoder) - - u16 m_width; // current pixel width of each element (changeable with source clipping) - u16 m_height; // current pixel height of each element (changeable with source clipping) - u16 m_startx; // current source clip X offset - u16 m_starty; // current source clip Y offset - - u16 m_origwidth; // starting pixel width of each element - u16 m_origheight; // staring pixel height of each element - u32 m_total_elements; // total number of decoded elements - - u32 m_color_base; // base color for rendering - u16 m_color_depth; // number of colors each pixel can represent - u16 m_color_granularity; // number of colors for each color code - u32 m_total_colors; // number of color codes - - u32 m_line_modulo; // bytes between each row of data - u32 m_char_modulo; // bytes between each element - const u8 * m_srcdata; // pointer to the source data for decoding - u32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied - - u8 * m_gfxdata; // pointer to decoded pixel data, 8bpp - std::vector m_gfxdata_allocated; // allocated decoded pixel data, 8bpp - std::vector m_dirty; // dirty array for detecting chars that need decoding - std::vector m_pen_usage; // bitmask of pens that are used (pens 0-31 only) - - bool m_layout_is_raw; // raw layout? - u8 m_layout_planes; // bit planes in the layout - u32 m_layout_xormask; // xor mask applied to each bit offset - u32 m_layout_charincrement; // per-character increment in source data - std::vector m_layout_planeoffset;// plane offsets - std::vector m_layout_xoffset; // X offsets - std::vector m_layout_yoffset; // Y offsets + device_palette_interface *m_palette; // palette used for drawing (optional when used as a pure decoder) + + u16 m_width; // current pixel width of each element (changeable with source clipping) + u16 m_height; // current pixel height of each element (changeable with source clipping) + u16 m_startx; // current source clip X offset + u16 m_starty; // current source clip Y offset + + u16 m_origwidth; // starting pixel width of each element + u16 m_origheight; // staring pixel height of each element + u32 m_total_elements; // total number of decoded elements + + u32 m_color_base; // base color for rendering + u16 m_color_depth; // number of colors each pixel can represent + u16 m_color_granularity; // number of colors for each color code + u32 m_total_colors; // number of color codes + + u32 m_line_modulo; // bytes between each row of data + u32 m_char_modulo; // bytes between each element + const u8 * m_srcdata; // pointer to the source data for decoding + u32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied + + u16 * m_gfxdata; // pointer to decoded pixel data, 16bpp + std::vector m_gfxdata_allocated; // allocated decoded pixel data, 8bpp + std::vector m_dirty; // dirty array for detecting chars that need decoding + std::vector m_pen_usage; // bitmask of pens that are used (pens 0-31 only) + + bool m_layout_is_raw; // raw layout? + bool m_layout_is_16bpp; // 16bpp raw layout? + u8 m_layout_planes; // bit planes in the layout + u32 m_layout_xormask; // xor mask applied to each bit offset + u32 m_layout_charincrement; // per-character increment in source data + std::vector m_layout_planeoffset; // plane offsets + std::vector m_layout_xoffset; // X offsets + std::vector m_layout_yoffset; // Y offsets }; -- cgit v1.2.3-70-g09d2