diff options
author | Vas Crabb <vas@vastheman.com> | 2020-11-13 15:26:31 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2020-11-13 15:26:31 +1100 |
commit | fe9ac15ca9f027d0eb5e21aa5496e3d6fa674e45 (patch) | |
tree | b48da30d7948f1e251b3f468de3fa7f3405d2a29 /src/emu/render.h | |
parent | 52285c255363d1f431eee95f0e8d01b546c33d48 (diff) |
-emu/devfind: More cleanup/consistency changes.
* Removed .mask(), as it’s not reliable in the general case.
* Added asserts to things that assume power-of-two sizes.
* Got rid of virtual qualifier on pointer-to-member operator.
* Made helpers a bit more assertive about logging warnings.
-emu/rendlay.cpp: Use delegates to avoid hot conditional branches.
-docs: Finished off description of object finders and output finders.
Diffstat (limited to 'src/emu/render.h')
-rw-r--r-- | src/emu/render.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/emu/render.h b/src/emu/render.h index 41cf1e42e1c..72e47c4b05f 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -176,6 +176,8 @@ namespace emu { namespace render { namespace detail { struct bounds_step { + constexpr render_bounds get() const { return bounds; } + int state; render_bounds bounds; render_bounds delta; @@ -184,6 +186,8 @@ using bounds_vector = std::vector<bounds_step>; struct color_step { + constexpr render_color get() const { return color; } + int state; render_color color; render_color delta; @@ -744,8 +748,8 @@ public: // getters layout_element *element() const { return m_element; } screen_device *screen() { return m_screen; } - render_bounds bounds() const; - render_color color() const; + render_bounds bounds() const { return m_get_bounds(); } + render_color color() const { return m_get_color(); } int blend_mode() const { return m_blend_mode; } u32 visibility_mask() const { return m_visibility_mask; } int orientation() const { return m_orientation; } @@ -757,7 +761,7 @@ public: bool clickthrough() const { return m_clickthrough; } // fetch state based on configured source - int state() const; + int state() const { return m_get_elem_state(); } // resolve tags, if any void resolve_tags(); @@ -765,8 +769,18 @@ public: private: using bounds_vector = emu::render::detail::bounds_vector; using color_vector = emu::render::detail::color_vector; - - int animation_state() const; + using state_delegate = delegate<int ()>; + using bounds_delegate = delegate<render_bounds ()>; + using color_delegate = delegate<render_color ()>; + + int get_output() const; + int get_input_raw() const; + int get_input_field_cached() const; + int get_input_field_conditional() const; + int get_anim_output() const; + int get_anim_input() const; + render_bounds get_interpolated_bounds() const; + render_color get_interpolated_color() const; static layout_element *find_element(view_environment &env, util::xml::data_node const &itemnode, element_map &elemmap); static bounds_vector make_bounds(view_environment &env, util::xml::data_node const &itemnode, layout_group::transform const &trans); @@ -780,10 +794,12 @@ public: // internal state layout_element *const m_element; // pointer to the associated element (non-screens only) + state_delegate m_get_elem_state; // resolved element state function + state_delegate m_get_anim_state; // resolved animation state function + bounds_delegate m_get_bounds; // resolved bounds function + color_delegate m_get_color; // resolved color function output_finder<> m_output; // associated output output_finder<> m_animoutput; // associated output for animation if different - bool const m_have_output; // whether we actually have an output - bool const m_have_animoutput; // whether we actually have an output for animation ioport_port * m_animinput_port; // input port used for animation ioport_value const m_animmask; // mask for animation state u8 const m_animshift; // shift for animation state @@ -804,6 +820,8 @@ public: std::string const m_input_tag; // input tag of this item std::string const m_animinput_tag; // tag of input port for animation state bounds_vector const m_rawbounds; // raw (original) bounds of the item + bool const m_have_output; // whether we actually have an output + bool const m_have_animoutput; // whether we actually have an output for animation bool const m_has_clickthrough; // whether clickthrough was explicitly configured }; using item_list = std::list<item>; |