summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-08-29 17:50:44 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-08-29 17:50:44 +0200
commit66e2f20c5610eb500b4a9cf22ef024492ba0fd00 (patch)
tree057c5018430402d5f9fcd17a3a7e06b780008c0c /vcl/unx
parent698153d9096f705cc5e16e8ae6fc0ebd9210c79d (diff)
CairoFontsCache is only used in cairotextrender.cxx
...so move it there and remove the VCL_DLLPUBLIC Change-Id: I1fc75984f8a9935e34cd9ac36d878809b538bd1e
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx38
1 files changed, 36 insertions, 2 deletions
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index d1ad18091d93..d86539354fb4 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -43,6 +43,42 @@
#include <cairo.h>
#include <cairo-ft.h>
+namespace {
+
+typedef struct FT_FaceRec_* FT_Face;
+
+class CairoFontsCache
+{
+public:
+ struct CacheId
+ {
+ FT_Face maFace;
+ const void *mpOptions;
+ bool mbEmbolden;
+ bool mbVerticalMetrics;
+ bool operator ==(const CacheId& rOther) const
+ {
+ return maFace == rOther.maFace &&
+ mpOptions == rOther.mpOptions &&
+ mbEmbolden == rOther.mbEmbolden &&
+ mbVerticalMetrics == rOther.mbVerticalMetrics;
+ }
+ };
+
+private:
+ typedef std::deque< std::pair<void *, CacheId> > LRUFonts;
+ static LRUFonts maLRUFonts;
+public:
+ CairoFontsCache() = delete;
+
+ static void CacheFont(void *pFont, const CacheId &rId);
+ static void* FindCachedFont(const CacheId &rId);
+};
+
+CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
+
+}
+
CairoTextRender::CairoTextRender()
: mnTextColor(MAKE_SALCOLOR(0x00, 0x00, 0x00)) //black
{
@@ -118,8 +154,6 @@ void ServerFontInstance::HandleFontOptions()
mpServerFont->SetFontOptions(mxFontOptions);
}
-CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
-
void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId)
{
maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) );