summaryrefslogtreecommitdiff
path: root/src/gui/sdlfont.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/sdlfont.h')
-rw-r--r--src/gui/sdlfont.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h
index 2e5376148..41edf4145 100644
--- a/src/gui/sdlfont.h
+++ b/src/gui/sdlfont.h
@@ -34,12 +34,31 @@
#endif
#include <list>
+#include <map>
#include <string>
#include "localconsts.h"
class Image;
+const unsigned int CACHES_NUMBER = 256;
+
+class SDLTextChunkSmall
+{
+ public:
+ SDLTextChunkSmall(const std::string &text0, const gcn::Color &color0,
+ const gcn::Color &color1);
+
+ SDLTextChunkSmall(const SDLTextChunkSmall &old);
+
+ bool operator==(const SDLTextChunkSmall &chunk) const;
+ bool operator<(const SDLTextChunkSmall &chunk) const;
+
+ std::string text;
+ gcn::Color color;
+ gcn::Color color2;
+};
+
class SDLTextChunk final
{
public:
@@ -79,6 +98,7 @@ class TextChunkList final
SDLTextChunk *start;
SDLTextChunk *end;
uint32_t size;
+ std::map<SDLTextChunkSmall, SDLTextChunk*> search;
};
/**
@@ -139,6 +159,7 @@ class SDLFont final : public gcn::Font
// Word surfaces cache
int mCleanTime;
+ mutable TextChunkList mCache[CACHES_NUMBER];
};
#ifdef UNITTESTS