Skip to content

Commit 8ad2cff

Browse files
committed
GUIFontCache: Switch Lookup to use std::span
1 parent b9e1fb1 commit 8ad2cff

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

xbmc/guilib/GUIFontCache.cpp

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class CGUIFontCacheImpl
8484
explicit CGUIFontCacheImpl(CGUIFontCache<Position, Value>* parent) : m_parent(parent) {}
8585
Value& Lookup(const CGraphicContext& context,
8686
Position& pos,
87-
const std::vector<KODI::UTILS::COLOR::Color>& colors,
88-
const vecText& text,
87+
std::span<const KODI::UTILS::COLOR::Color> colors,
88+
std::span<const character_t> text,
8989
uint32_t alignment,
9090
float maxPixelWidth,
9191
bool scrolling,
@@ -131,8 +131,8 @@ CGUIFontCache<Position, Value>::~CGUIFontCache() = default;
131131
template<class Position, class Value>
132132
Value& CGUIFontCache<Position, Value>::Lookup(const CGraphicContext& context,
133133
Position& pos,
134-
const std::vector<KODI::UTILS::COLOR::Color>& colors,
135-
const vecText& text,
134+
std::span<const KODI::UTILS::COLOR::Color> colors,
135+
std::span<const character_t> text,
136136
uint32_t alignment,
137137
float maxPixelWidth,
138138
bool scrolling,
@@ -147,21 +147,19 @@ Value& CGUIFontCache<Position, Value>::Lookup(const CGraphicContext& context,
147147
}
148148

149149
template<class Position, class Value>
150-
Value& CGUIFontCacheImpl<Position, Value>::Lookup(
151-
const CGraphicContext& context,
152-
Position& pos,
153-
const std::vector<KODI::UTILS::COLOR::Color>& colors,
154-
const vecText& text,
155-
uint32_t alignment,
156-
float maxPixelWidth,
157-
bool scrolling,
158-
std::chrono::steady_clock::time_point now,
159-
bool& dirtyCache)
150+
Value& CGUIFontCacheImpl<Position, Value>::Lookup(const CGraphicContext& context,
151+
Position& pos,
152+
std::span<const KODI::UTILS::COLOR::Color> colors,
153+
std::span<const character_t> text,
154+
uint32_t alignment,
155+
float maxPixelWidth,
156+
bool scrolling,
157+
std::chrono::steady_clock::time_point now,
158+
bool& dirtyCache)
160159
{
161-
const CGUIFontCacheKey<Position> key(
162-
pos, const_cast<std::vector<KODI::UTILS::COLOR::Color>&>(colors), const_cast<vecText&>(text),
163-
alignment, maxPixelWidth, scrolling, context.GetGUIMatrix(), context.GetGUIScaleX(),
164-
context.GetGUIScaleY());
160+
const CGUIFontCacheKey<Position> key(pos, colors, text, alignment, maxPixelWidth, scrolling,
161+
context.GetGUIMatrix(), context.GetGUIScaleX(),
162+
context.GetGUIScaleY());
165163

166164
auto i = m_list.FindKey(key);
167165
if (i == m_list.hashMap.end())
@@ -227,8 +225,8 @@ template CGUIFontCacheStaticValue& CGUIFontCache<
227225
CGUIFontCacheStaticPosition,
228226
CGUIFontCacheStaticValue>::Lookup(const CGraphicContext& context,
229227
CGUIFontCacheStaticPosition&,
230-
const std::vector<KODI::UTILS::COLOR::Color>&,
231-
const vecText&,
228+
std::span<const KODI::UTILS::COLOR::Color> colors,
229+
std::span<const character_t> text,
232230
uint32_t,
233231
float,
234232
bool,
@@ -245,8 +243,8 @@ template CGUIFontCacheDynamicValue& CGUIFontCache<
245243
CGUIFontCacheDynamicPosition,
246244
CGUIFontCacheDynamicValue>::Lookup(const CGraphicContext& context,
247245
CGUIFontCacheDynamicPosition&,
248-
const std::vector<KODI::UTILS::COLOR::Color>&,
249-
const vecText&,
246+
std::span<const KODI::UTILS::COLOR::Color> colors,
247+
std::span<const character_t> text,
250248
uint32_t,
251249
float,
252250
bool,

xbmc/guilib/GUIFontCache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ class CGUIFontCache
160160

161161
Value& Lookup(const CGraphicContext& context,
162162
Position& pos,
163-
const std::vector<KODI::UTILS::COLOR::Color>& colors,
164-
const vecText& text,
163+
std::span<const KODI::UTILS::COLOR::Color> colors,
164+
std::span<const character_t> text,
165165
uint32_t alignment,
166166
float maxPixelWidth,
167167
bool scrolling,

0 commit comments

Comments
 (0)