summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/render.cpp42
-rw-r--r--src/emu/render.h51
-rw-r--r--src/emu/rendlay.cpp25
3 files changed, 35 insertions, 83 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index f20650fb4be..b25e18fa968 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -1062,17 +1062,18 @@ int render_target::configured_view(const char *viewname, int targetindex, int nu
{
int ourindex = index() % scrcount;
screen_device *screen = iter.byindex(ourindex);
+ assert(screen != nullptr);
// find the first view with this screen and this screen only
for (view = view_by_index(viewindex = 0); view != nullptr; view = view_by_index(++viewindex))
{
- const render_screen_list &viewscreens = view->screens();
- if (viewscreens.count() == 0)
+ auto const &viewscreens = view->screens();
+ if (viewscreens.empty())
{
view = nullptr;
break;
}
- else if (viewscreens.count() == viewscreens.contains(*screen))
+ else if (std::find_if(viewscreens.begin(), viewscreens.end(), [&screen](auto const &scr) { return &scr.get() != screen; }) == viewscreens.end())
break;
}
}
@@ -1082,13 +1083,12 @@ int render_target::configured_view(const char *viewname, int targetindex, int nu
{
for (view = view_by_index(viewindex = 0); view != nullptr; view = view_by_index(++viewindex))
{
- render_screen_list const &viewscreens(view->screens());
- if (viewscreens.count() >= scrcount)
+ if (view->screen_count() >= scrcount)
{
bool screen_missing(false);
for (screen_device &screen : iter)
{
- if (!viewscreens.contains(screen))
+ if (!view->has_screen(screen))
{
screen_missing = true;
break;
@@ -1118,19 +1118,6 @@ const char *render_target::view_name(int viewindex)
//-------------------------------------------------
-// render_target_get_view_screens - return a
-// bitmask of which screens are visible on a
-// given view
-//-------------------------------------------------
-
-const render_screen_list &render_target::view_screens(int viewindex)
-{
- layout_view *view = view_by_index(viewindex);
- return (view != nullptr) ? view->screens() : s_empty_screen_list;
-}
-
-
-//-------------------------------------------------
// compute_visible_area - compute the visible
// area for the given target with the current
// layout and proposed new parameters
@@ -1797,13 +1784,12 @@ void render_target::load_additional_layout_files(const char *basename, bool have
int viewindex(0);
for (layout_view *view = view_by_index(viewindex); need_tiles && view; view = view_by_index(++viewindex))
{
- render_screen_list const &viewscreens(view->screens());
- if (viewscreens.count() >= screens.size())
+ if (view->screen_count() >= screens.size())
{
bool screen_missing(false);
for (screen_device &screen : iter)
{
- if (!viewscreens.contains(screen))
+ if (!view->has_screen(screen))
{
screen_missing = true;
break;
@@ -2977,9 +2963,15 @@ render_manager::~render_manager()
bool render_manager::is_live(screen_device &screen) const
{
// iterate over all live targets and or together their screen masks
- for (render_target &target : m_targetlist)
- if (!target.hidden() && target.view_screens(target.view()).contains(screen))
- return true;
+ for (render_target const &target : m_targetlist)
+ {
+ if (!target.hidden())
+ {
+ layout_view const *view = target.current_view();
+ if (view != nullptr && view->has_screen(screen))
+ return true;
+ }
+ }
return false;
}
diff --git a/src/emu/render.h b/src/emu/render.h
index 572b29e0933..3a34066b096 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -222,49 +222,6 @@ struct render_texinfo
};
-// ======================> render_screen_list
-
-// a render_screen_list is a list of screen_devices
-class render_screen_list
-{
- // screen list item
- class item
- {
- friend class simple_list<item>;
- friend class render_screen_list;
-
- public:
- // construction/destruction
- item(screen_device &screen) : m_screen(screen) { }
-
- // state
- item * m_next = nullptr; // next screen in list
- screen_device & m_screen; // reference to screen device
- };
-
-public:
- // getters
- int count() const { return m_list.count(); }
-
- // operations
- void add(screen_device &screen) { m_list.append(*global_alloc(item(screen))); }
- void reset() { m_list.reset(); }
-
- // query
- int contains(screen_device &screen) const
- {
- int count = 0;
- for (item *curitem = m_list.first(); curitem; curitem = curitem->m_next)
- if (&curitem->m_screen == &screen) count++;
- return count;
- }
-
-private:
- // internal state
- simple_list<item> m_list;
-};
-
-
// ======================> render_layer_config
// render_layer_config - describes the state of layers
@@ -771,6 +728,7 @@ public:
using environment = emu::render::detail::layout_environment;
using element_map = std::unordered_map<std::string, layout_element>;
using group_map = std::unordered_map<std::string, layout_group>;
+ using render_screen_list = std::list<std::reference_wrapper<screen_device>>;
/// \brief A single backdrop/screen/overlay/bezel/cpanel/marquee item
///
@@ -855,10 +813,12 @@ public:
const render_bounds &bounds() const { return m_bounds; }
const render_bounds &screen_bounds() const { return m_scrbounds; }
const render_screen_list &screens() const { return m_screens; }
+ size_t screen_count() const { return m_screens.size(); }
+ bool has_screen(screen_device &screen) const;
//
bool has_art() const { return m_has_art; }
- float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; }
+ float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && !m_screens.empty()) ? m_scraspect : m_aspect; }
// operations
void recompute(render_layer_config layerconfig);
@@ -989,7 +949,6 @@ public:
// view information
const char *view_name(int viewindex);
- const render_screen_list &view_screens(int viewindex);
// bounds computations
void compute_visible_area(s32 target_width, s32 target_height, float target_pixel_aspect, int target_orientation, s32 &visible_width, s32 &visible_height);
@@ -1079,8 +1038,6 @@ private:
s32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents
bool m_transform_container; // determines whether the screen container is transformed by the core renderer,
// otherwise the respective render API will handle the transformation (scale, offset)
-
- static render_screen_list s_empty_screen_list;
};
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index c8c68b84b82..3df68232710 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -841,14 +841,6 @@ public:
//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-render_screen_list render_target::s_empty_screen_list;
-
-
-
-//**************************************************************************
// LAYOUT ELEMENT
//**************************************************************************
@@ -3026,6 +3018,17 @@ layout_view::~layout_view()
//-------------------------------------------------
+// has_screen - return true if this view contains
+// the given screen
+//-------------------------------------------------
+
+bool layout_view::has_screen(screen_device &screen) const
+{
+ return std::find_if(m_screens.begin(), m_screens.end(), [&screen](auto const &scr) { return &scr.get() == &screen; }) != m_screens.end();
+}
+
+
+//-------------------------------------------------
// recompute - recompute the bounds and aspect
// ratio of a view and all of its contained items
//-------------------------------------------------
@@ -3035,7 +3038,7 @@ void layout_view::recompute(render_layer_config layerconfig)
// reset the bounds
m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f;
m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f;
- m_screens.reset();
+ m_screens.clear();
// loop over all layers
bool first = true;
@@ -3059,7 +3062,7 @@ void layout_view::recompute(render_layer_config layerconfig)
scrfirst = false;
// accumulate the screens in use while we're scanning
- m_screens.add(*curitem.m_screen);
+ m_screens.emplace_back(*curitem.m_screen);
}
}
@@ -3069,7 +3072,7 @@ void layout_view::recompute(render_layer_config layerconfig)
// if we're handling things normally, the target bounds are (0,0)-(1,1)
render_bounds target_bounds;
- if (!layerconfig.zoom_to_screen() || m_screens.count() == 0)
+ if (!layerconfig.zoom_to_screen() || m_screens.empty())
{
// compute the aspect ratio of the view
m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0);