diff options
Diffstat (limited to 'src/frontend/mame/ui/widgets.cpp')
-rw-r--r-- | src/frontend/mame/ui/widgets.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index d8907303b36..cc2c276abfc 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -14,7 +14,6 @@ namespace ui { - /*************************************************************************** WIDGETS ***************************************************************************/ @@ -25,12 +24,12 @@ namespace ui { widgets_manager::widgets_manager(running_machine &machine) : m_hilight_bitmap(std::make_unique<bitmap_argb32>(256, 1)) - , m_hilight_texture(nullptr, machine.render()) + , m_hilight_texture() , m_hilight_main_bitmap(std::make_unique<bitmap_argb32>(1, 128)) - , m_hilight_main_texture(nullptr, machine.render()) - , m_arrow_texture(nullptr, machine.render()) + , m_hilight_main_texture() { render_manager &render(machine.render()); + auto const texture_free([&render](render_texture *texture) { render.texture_free(texture); }); // create a texture for hilighting items for (unsigned x = 0; x < 256; ++x) @@ -38,7 +37,7 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const alpha((x < 25) ? (0xff * x / 25) : (x >(256 - 25)) ? (0xff * (255 - x) / 25) : 0xff); m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); } - m_hilight_texture.reset(render.texture_alloc()); + m_hilight_texture = texture_ptr(render.texture_alloc(), texture_free); m_hilight_texture->set_bitmap(*m_hilight_bitmap, m_hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); // create a texture for hilighting items in main menu @@ -51,11 +50,11 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const b = b1 + (y * (b2 - b1) / 128); m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b); } - m_hilight_main_texture.reset(render.texture_alloc()); + m_hilight_main_texture = texture_ptr(render.texture_alloc(), texture_free); m_hilight_main_texture->set_bitmap(*m_hilight_main_bitmap, m_hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); // create a texture for arrow icons - m_arrow_texture.reset(render.texture_alloc(render_triangle)); + m_arrow_texture = texture_ptr(render.texture_alloc(render_triangle), texture_free); } |