16 #include "utils/ColorUtils.h" 17 #include "utils/TransformMatrix.h" 28 constexpr
float FONT_CACHE_DIST_LIMIT = 0.01f;
32 template<
class Position,
class Value>
36 template<
class Position,
class Value>
39 template<
class Position>
43 std::vector<UTILS::COLOR::Color>& m_colors;
46 float m_maxPixelWidth;
53 std::vector<UTILS::COLOR::Color>& colors,
64 m_alignment(alignment),
65 m_maxPixelWidth(maxPixelWidth),
66 m_scrolling(scrolling),
74 template<
class Position,
class Value>
80 std::chrono::steady_clock::time_point m_lastUsed;
85 std::chrono::steady_clock::time_point now)
88 *
new std::vector<UTILS::COLOR::Color>,
98 m_key.m_colors.assign(key.m_colors.begin(), key.m_colors.end());
99 m_key.m_text.assign(key.m_text.begin(), key.m_text.end());
100 m_matrix = key.m_matrix;
108 template<
class Position>
115 for (i = 0; i < 3 && i < key.m_text.size(); ++i)
116 hash += key.m_text[i];
117 if (key.m_colors.size())
118 hash += key.m_colors[0];
119 hash += static_cast<size_t>(MatrixHashContribution(key));
124 template<
class Position>
130 return a.m_text == b.m_text &&
131 a.m_colors == b.m_colors &&
132 a.m_alignment == b.m_alignment &&
133 a.m_scrolling == b.m_scrolling &&
134 a.m_maxPixelWidth == b.m_maxPixelWidth &&
135 Match(a.m_pos, a.m_matrix, b.m_pos, b.m_matrix, a.m_scrolling) &&
136 a.m_scaleX == b.m_scaleX &&
137 a.m_scaleY == b.m_scaleY;
143 template<
class Position,
class Value>
146 std::unique_ptr<CGUIFontCacheImpl<Position, Value>> m_impl;
160 const std::vector<UTILS::COLOR::Color>& colors,
165 std::chrono::steady_clock::time_point now,
193 return a.m_x == b.m_x && a.m_y == b.m_y && a_m == b_m;
199 return a.m_matrix.m[0][3];
212 m_x = m_x - cached.m_x;
214 m_x = floorf(m_x - cached.m_x + FONT_CACHE_DIST_LIMIT);
215 m_y = floorf(m_y - cached.m_y + FONT_CACHE_DIST_LIMIT);
216 m_z = floorf(m_z - cached.m_z + FONT_CACHE_DIST_LIMIT);
222 #if defined(HAS_GL) || defined(HAS_GLES) 223 typedef unsigned int BufferHandleType;
224 #define BUFFER_HANDLE_INIT 0 225 #elif defined(HAS_DX) 226 typedef void* BufferHandleType;
227 #define BUFFER_HANDLE_INIT nullptr 229 BufferHandleType bufferHandle = BUFFER_HANDLE_INIT;
233 : bufferHandle(bufferHandle), size(size), m_font(font)
237 : bufferHandle(other.bufferHandle), size(other.size), m_font(other.m_font)
242 assert(other.bufferHandle == 0);
247 assert(bufferHandle == 0);
248 bufferHandle = other.bufferHandle;
249 other.bufferHandle = 0;
251 m_font = other.m_font;
268 float diffX = a.m_x - b.m_x + FONT_CACHE_DIST_LIMIT;
269 float diffY = a.m_y - b.m_y + FONT_CACHE_DIST_LIMIT;
270 float diffZ = a.m_z - b.m_z + FONT_CACHE_DIST_LIMIT;
273 diffX - floorf(diffX) < 2 * FONT_CACHE_DIST_LIMIT) &&
274 diffY - floorf(diffY) < 2 * FONT_CACHE_DIST_LIMIT &&
275 diffZ - floorf(diffZ) < 2 * FONT_CACHE_DIST_LIMIT &&
276 a_m.m[0][0] == b_m.m[0][0] &&
277 a_m.m[1][1] == b_m.m[1][1] &&
278 a_m.m[2][2] == b_m.m[2][2];
Definition: GUIFontCache.h:178
Definition: GUIFontTTF.h:76
Definition: GUIFontCache.h:125
Definition: GUIFontCache.h:33
Definition: GUIFontCache.h:109
Definition: GUIFontCache.h:170
Definition: LibInputPointer.h:13
Definition: GUIFontCache.h:220
Definition: GUIFontCache.h:40
Definition: GUIFontCache.h:75
Definition: GUIFontCache.cpp:23
Definition: GUIFontCache.h:202
Definition: GraphicContext.h:60