diff options
Diffstat (limited to 'src/emu/digfx.cpp')
-rw-r--r-- | src/emu/digfx.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/emu/digfx.cpp b/src/emu/digfx.cpp index 933dd5a72c5..bed430e64f0 100644 --- a/src/emu/digfx.cpp +++ b/src/emu/digfx.cpp @@ -22,11 +22,11 @@ device_gfx_interface::device_gfx_interface(const machine_config &mconfig, device_t &device, const gfx_decode_entry *gfxinfo, const char *palette_tag) - : device_interface(device, "gfx"), - m_palette(NULL), + : device_interface(device, "gfx"), + m_palette(nullptr), m_gfxdecodeinfo(gfxinfo), m_palette_tag(palette_tag), - m_palette_is_sibling(palette_tag == NULL), + m_palette_is_sibling(palette_tag == nullptr), m_decoded(false) { } @@ -78,7 +78,7 @@ void device_gfx_interface::static_set_palette(device_t &device, const char *tag) void device_gfx_interface::interface_pre_start() { - if (m_palette_tag == NULL) + if (m_palette_tag == nullptr) fatalerror("No palette specified for device '%s'\n", device().tag()); // find our palette device, either as a sibling device or subdevice @@ -87,7 +87,7 @@ void device_gfx_interface::interface_pre_start() else m_palette = device().subdevice<palette_device>(m_palette_tag); - if (m_palette == NULL) + if (m_palette == nullptr) fatalerror("Device '%s' specifies nonexistent %sdevice '%s' as palette\n", device().tag(), (m_palette_is_sibling ? "sibling " : "sub"), @@ -119,7 +119,7 @@ void device_gfx_interface::interface_post_start() void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) { // skip if nothing to do - if (gfxdecodeinfo == NULL) + if (gfxdecodeinfo == nullptr) return; // local variables to hold mutable copies of gfx layout data @@ -128,7 +128,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) std::vector<UINT32> extyoffs(0); // loop over all elements - for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++) + for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != nullptr; curgfx++) { const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx]; @@ -143,13 +143,13 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) UINT8 region_width; endianness_t region_endianness; - if (gfx.memory_region != NULL) + if (gfx.memory_region != nullptr) { device_t &basedevice = (GFXENTRY_ISDEVICE(gfx.flags)) ? device() : *device().owner(); if (GFXENTRY_ISRAM(gfx.flags)) { memory_share *share = basedevice.memshare(gfx.memory_region); - assert(share != NULL); + assert(share != nullptr); region_length = 8 * share->bytes(); region_base = reinterpret_cast<UINT8 *>(share->ptr()); region_width = share->bytewidth(); @@ -158,7 +158,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) else { memory_region *region = basedevice.memregion(gfx.memory_region); - assert(region != NULL); + assert(region != nullptr); region_length = 8 * region->bytes(); region_base = region->base(); region_width = region->bytewidth(); @@ -168,7 +168,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) else { region_length = 0; - region_base = NULL; + region_base = nullptr; region_width = 1; region_endianness = ENDIANNESS_NATIVE; } @@ -205,8 +205,8 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // copy the X and Y offsets into our temporary arrays extxoffs.resize(glcopy.width * xscale); extyoffs.resize(glcopy.height * yscale); - memcpy(&extxoffs[0], (glcopy.extxoffs != NULL) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(UINT32)); - memcpy(&extyoffs[0], (glcopy.extyoffs != NULL) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(UINT32)); + memcpy(&extxoffs[0], (glcopy.extxoffs != nullptr) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(UINT32)); + memcpy(&extyoffs[0], (glcopy.extyoffs != nullptr) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(UINT32)); // always use the extended offsets here glcopy.extxoffs = &extxoffs[0]; @@ -276,7 +276,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) } // allocate the graphics - m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start))); + m_gfx[curgfx] = std::make_unique<gfx_element>(m_palette, glcopy, (region_base != nullptr) ? region_base + gfx.start : nullptr, xormask, gfx.total_color_codes, gfx.color_codes_start); } m_decoded = true; @@ -291,7 +291,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) void device_gfx_interface::interface_validity_check(validity_checker &valid) const { // validate palette tag - if (m_palette_tag == NULL) + if (m_palette_tag == nullptr) osd_printf_error("No palette specified for device '%s'\n", device().tag()); else { @@ -301,7 +301,7 @@ void device_gfx_interface::interface_validity_check(validity_checker &valid) con else palette = device().subdevice<palette_device>(m_palette_tag); - if (palette == NULL) + if (palette == nullptr) osd_printf_error("Device '%s' specifies nonexistent %sdevice '%s' as palette\n", device().tag(), (m_palette_is_sibling ? "sibling " : "sub"), @@ -312,14 +312,14 @@ void device_gfx_interface::interface_validity_check(validity_checker &valid) con return; // validate graphics decoding entries - for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++) + for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != nullptr; gfxnum++) { const gfx_decode_entry &gfx = m_gfxdecodeinfo[gfxnum]; const gfx_layout &layout = *gfx.gfxlayout; // currently we are unable to validate RAM-based entries const char *region = gfx.memory_region; - if (region != NULL && GFXENTRY_ISROM(gfx.flags)) + if (region != nullptr && GFXENTRY_ISROM(gfx.flags)) { // resolve the region std::string gfxregion; @@ -372,9 +372,9 @@ void device_gfx_interface::interface_validity_check(validity_checker &valid) con { if (layout.planes > MAX_GFX_PLANES) osd_printf_error("gfx[%d] planes > %d\n", gfxnum, MAX_GFX_PLANES); - if (layout.width > MAX_GFX_SIZE && layout.extxoffs == NULL) + if (layout.width > MAX_GFX_SIZE && layout.extxoffs == nullptr) osd_printf_error("gfx[%d] width > %d but missing extended xoffset info\n", gfxnum, MAX_GFX_SIZE); - if (layout.height > MAX_GFX_SIZE && layout.extyoffs == NULL) + if (layout.height > MAX_GFX_SIZE && layout.extyoffs == nullptr) osd_printf_error("gfx[%d] height > %d but missing extended yoffset info\n", gfxnum, MAX_GFX_SIZE); } } |