mirror of
https://github.com/holub/mame
synced 2025-07-03 00:56:03 +03:00
simple_list to vector in screen (nw)
This commit is contained in:
parent
025756c2d6
commit
1071a620f5
@ -1097,8 +1097,8 @@ void screen_device::realloc_screen_bitmaps()
|
||||
INT32 effheight = MAX(m_height, m_visarea.max_y + 1);
|
||||
|
||||
// reize all registered screen bitmaps
|
||||
for (auto_bitmap_item &item : m_auto_bitmap_list)
|
||||
item.m_bitmap.resize(effwidth, effheight);
|
||||
for (auto &item : m_auto_bitmap_list)
|
||||
item->m_bitmap.resize(effwidth, effheight);
|
||||
|
||||
// re-set up textures
|
||||
if (m_palette != nullptr)
|
||||
@ -1449,12 +1449,12 @@ void screen_device::register_vblank_callback(vblank_state_delegate vblank_callba
|
||||
assert(!vblank_callback.isnull());
|
||||
|
||||
// do nothing if we already have this callback registered
|
||||
for (callback_item &item : m_callback_list)
|
||||
if (item.m_callback == vblank_callback)
|
||||
for (auto &item : m_callback_list)
|
||||
if (item->m_callback == vblank_callback)
|
||||
return;
|
||||
|
||||
// if not found, register
|
||||
m_callback_list.append(*global_alloc(callback_item(vblank_callback)));
|
||||
m_callback_list.push_back(std::make_unique<callback_item>(vblank_callback));
|
||||
}
|
||||
|
||||
|
||||
@ -1466,7 +1466,7 @@ void screen_device::register_vblank_callback(vblank_state_delegate vblank_callba
|
||||
void screen_device::register_screen_bitmap(bitmap_t &bitmap)
|
||||
{
|
||||
// append to the list
|
||||
m_auto_bitmap_list.append(*global_alloc(auto_bitmap_item(bitmap)));
|
||||
m_auto_bitmap_list.push_back(std::make_unique<auto_bitmap_item>(bitmap));
|
||||
|
||||
// if allocating now, just do it
|
||||
bitmap.allocate(width(), height());
|
||||
@ -1491,8 +1491,8 @@ void screen_device::vblank_begin()
|
||||
machine().video().frame_update();
|
||||
|
||||
// call the screen specific callbacks
|
||||
for (callback_item &item : m_callback_list)
|
||||
item.m_callback(*this, true);
|
||||
for (auto &item : m_callback_list)
|
||||
item->m_callback(*this, true);
|
||||
if (!m_screen_vblank.isnull())
|
||||
m_screen_vblank(*this, true);
|
||||
|
||||
@ -1515,8 +1515,8 @@ void screen_device::vblank_begin()
|
||||
void screen_device::vblank_end()
|
||||
{
|
||||
// call the screen specific callbacks
|
||||
for (callback_item &item : m_callback_list)
|
||||
item.m_callback(*this, false);
|
||||
for (auto &item : m_callback_list)
|
||||
item->m_callback(*this, false);
|
||||
if (!m_screen_vblank.isnull())
|
||||
m_screen_vblank(*this, false);
|
||||
|
||||
|
@ -345,28 +345,21 @@ private:
|
||||
{
|
||||
public:
|
||||
callback_item(vblank_state_delegate callback)
|
||||
: m_next(nullptr),
|
||||
m_callback(std::move(callback)) { }
|
||||
callback_item *next() const { return m_next; }
|
||||
: m_callback(std::move(callback)) { }
|
||||
|
||||
callback_item * m_next;
|
||||
vblank_state_delegate m_callback;
|
||||
};
|
||||
simple_list<callback_item> m_callback_list; // list of VBLANK callbacks
|
||||
std::vector<std::unique_ptr<callback_item>> m_callback_list; // list of VBLANK callbacks
|
||||
|
||||
// auto-sizing bitmaps
|
||||
class auto_bitmap_item
|
||||
{
|
||||
public:
|
||||
auto_bitmap_item(bitmap_t &bitmap)
|
||||
: m_next(nullptr),
|
||||
m_bitmap(bitmap) { }
|
||||
auto_bitmap_item *next() const { return m_next; }
|
||||
|
||||
auto_bitmap_item * m_next;
|
||||
: m_bitmap(bitmap) { }
|
||||
bitmap_t & m_bitmap;
|
||||
};
|
||||
simple_list<auto_bitmap_item> m_auto_bitmap_list; // list of registered bitmaps
|
||||
std::vector<std::unique_ptr<auto_bitmap_item>> m_auto_bitmap_list; // list of registered bitmaps
|
||||
|
||||
// static data
|
||||
static UINT32 m_id_counter; // incremented for each constructed screen_device,
|
||||
|
Loading…
Reference in New Issue
Block a user