mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
sprite: Add some sanity checks (nw)
This commit is contained in:
parent
d991043cea
commit
dd46572f6d
@ -98,7 +98,7 @@ sparse_dirty_rect *sparse_dirty_bitmap::first_dirty_rect(const rectangle &clipre
|
||||
{
|
||||
// if what we have is valid, just return it again
|
||||
if (m_rect_list_bounds == cliprect)
|
||||
return m_rect_list.first();
|
||||
return m_rect_list.empty() ? nullptr : m_rect_list.first();
|
||||
|
||||
// reclaim the dirty list and start over
|
||||
m_rect_allocator.reclaim_all(m_rect_list);
|
||||
@ -153,5 +153,5 @@ sparse_dirty_rect *sparse_dirty_bitmap::first_dirty_rect(const rectangle &clipre
|
||||
|
||||
// mark the list as valid
|
||||
m_rect_list_bounds = cliprect;
|
||||
return m_rect_list.first();
|
||||
return m_rect_list.empty() ? nullptr : m_rect_list.first();
|
||||
}
|
||||
|
@ -105,13 +105,13 @@ public:
|
||||
_SpriteRAMType *buffer() { return &m_buffer[0]; }
|
||||
|
||||
// configuration
|
||||
void set_spriteram(_SpriteRAMType *base, uint32_t bytes) { m_spriteram = base; m_spriteram_bytes = bytes; m_buffer.resize(m_spriteram_bytes / sizeof(_SpriteRAMType)); }
|
||||
void set_spriteram(_SpriteRAMType *base, uint32_t bytes) { assert(base != nullptr && bytes != 0); m_spriteram = base; m_spriteram_bytes = bytes; m_buffer.resize(m_spriteram_bytes / sizeof(_SpriteRAMType)); }
|
||||
void set_origin(int32_t xorigin = 0, int32_t yorigin = 0) { m_xorigin = xorigin; m_yorigin = yorigin; }
|
||||
void set_xorigin(int32_t xorigin) { m_xorigin = xorigin; }
|
||||
void set_yorigin(int32_t yorigin) { m_yorigin = yorigin; }
|
||||
|
||||
// buffering
|
||||
void copy_to_buffer() { memcpy(m_buffer, m_spriteram, m_spriteram_bytes); }
|
||||
void copy_to_buffer() { assert(m_spriteram != nullptr); memcpy(m_buffer, m_spriteram, m_spriteram_bytes); }
|
||||
|
||||
// clearing
|
||||
void clear() { clear(m_bitmap.cliprect()); }
|
||||
|
Loading…
Reference in New Issue
Block a user