Skip to content

Commit fa5c2da

Browse files
committed
GUITextLayout: Don't create unnecessary std::vector
1 parent 4191a20 commit fa5c2da

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

xbmc/guilib/GUITextLayout.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <algorithm>
2020
#include <functional>
21+
#include <iterator>
2122
#include <limits>
2223

2324
CGUIString::CGUIString(iString start, iString end, bool carriageReturn)
@@ -161,11 +162,6 @@ void CGUITextLayout::RenderOutline(float x,
161162
if (!m_font)
162163
return;
163164

164-
// set the outline color
165-
std::vector<KODI::UTILS::COLOR::Color> outlineColors;
166-
if (!m_colors.empty())
167-
outlineColors.push_back(outlineColor);
168-
169165
// center our text vertically
170166
if (alignment & XBFONT_CENTER_Y)
171167
{
@@ -197,7 +193,7 @@ void CGUITextLayout::RenderOutline(float x,
197193

198194
// don't pass maxWidth through to the renderer for the same reason above: it will cause clipping
199195
// on the left.
200-
m_borderFont->DrawText(bx, by, outlineColors, 0, string.m_text, align, 0);
196+
m_borderFont->DrawText(bx, by, outlineColor, 0, string.m_text, align, 0);
201197
by += m_borderFont->GetLineHeight();
202198
}
203199
m_borderFont->End();
@@ -661,7 +657,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth)
661657
// current line is empty and word is too long: split by character using a safe linear scan.
662658
// Do not assume monotonic width because shaping/kerning can make width shrink or grow non-linearly.
663659
size_t bestCount = 0;
664-
for (auto it = current; it != wordEnd; ++it)
660+
for (auto it = std::next(current); it <= wordEnd; ++it)
665661
{
666662
if (m_font->GetTextWidth({current, it}) <= maxWidth)
667663
bestCount = std::distance(current, it);

0 commit comments

Comments
 (0)