From 44680b6ce80221e91cb14dca9ca7fad7015f1297 Mon Sep 17 00:00:00 2001 From: louis Date: Thu, 12 Mar 2015 17:28:35 +0100 Subject: version 0.3.0 --- libcore/imagecache.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'libcore/imagecache.c') diff --git a/libcore/imagecache.c b/libcore/imagecache.c index 2a9a948..e6188d2 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -4,6 +4,7 @@ #include #include #include "imagecache.h" +#include "cairoimage.h" #include "../config.h" #include "helpers.h" @@ -331,6 +332,28 @@ cImage *cImageCache::GetSkinpart(string name, int width, int height) { return NULL; } +cImage *cImageCache::GetVerticalText(string text, tColor color, string font, int size) { + cMutexLock MutexLock(&mutex); + stringstream buf; + buf << text << "_" << size; + string imgName = buf.str(); + map::iterator hit = cairoImageCache.find(imgName); + if (hit != cairoImageCache.end()) { + return (cImage*)hit->second; + } else { + cCairoImage c; + c.DrawTextVertical(text, color, font, size); + cImage *image = c.GetImage(); + cairoImageCache.insert(pair(imgName, image)); + hit = cairoImageCache.find(imgName); + if (hit != cairoImageCache.end()) { + return (cImage*)hit->second; + } + } + return NULL; +} + + bool cImageCache::LoadIcon(eImageType type, string name) { cString subdir(""); if (type == itMenuIcon) @@ -409,11 +432,17 @@ void cImageCache::Clear(void) { } channelLogoCache.clear(); - for(map::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) { + for(map::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; } skinPartsCache.clear(); + + for(map::const_iterator it = cairoImageCache.begin(); it != cairoImageCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + cairoImageCache.clear(); } void cImageCache::Debug(bool full) { -- cgit v1.2.3