summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/text.cpp
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-06-18 11:55:46 -0400
committer Nathan Woods <npwoods@mess.org>2016-06-18 14:46:20 -0400
commit940a94a93b7902ea7530070dca4f91bee68638f9 (patch)
treeda3b7e31e180ca2bb687a77b7ad2016f65d2defc /src/frontend/mame/ui/text.cpp
parent56192973740b717f66126bbe2969c7d44f9e6364 (diff)
Changed mame_ui_manager::draw_text_box() to use ui::text_layout directly
Diffstat (limited to 'src/frontend/mame/ui/text.cpp')
-rw-r--r--src/frontend/mame/ui/text.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp
index e4d61dc1238..cfe53c8e4aa 100644
--- a/src/frontend/mame/ui/text.cpp
+++ b/src/frontend/mame/ui/text.cpp
@@ -212,13 +212,41 @@ void text_layout::update_maximum_line_width()
//-------------------------------------------------
+// actual_left
+//-------------------------------------------------
+
+float text_layout::actual_left() const
+{
+ float result;
+ if (empty())
+ {
+ // degenerate scenario
+ result = 0;
+ }
+ else
+ {
+ result = 1.0f;
+ for (const auto &line : m_lines)
+ {
+ result = std::min(result, line->xoffset());
+
+ // take an opportunity to break out easily
+ if (result <= 0)
+ break;
+ }
+ }
+ return result;
+}
+
+
+//-------------------------------------------------
// actual_width
//-------------------------------------------------
float text_layout::actual_width() const
{
float current_line_width = m_current_line ? m_current_line->width() : 0;
- return MAX(m_maximum_line_width, current_line_width);
+ return std::max(m_maximum_line_width, current_line_width);
}
@@ -492,7 +520,7 @@ void text_layout::line::add_character(unicode_char ch, const char_style &style,
m_width += chwidth;
// we might be bigger
- m_height = MAX(m_height, style.size * m_layout.yscale());
+ m_height = std::max(m_height, style.size * m_layout.yscale());
}