summaryrefslogtreecommitdiff
path: root/libcore/imagecache.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcore/imagecache.c')
-rw-r--r--libcore/imagecache.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/libcore/imagecache.c b/libcore/imagecache.c
index f9878fe..2e6a0fc 100644
--- a/libcore/imagecache.c
+++ b/libcore/imagecache.c
@@ -2,6 +2,7 @@
#include <sstream>
#include <map>
#include <fstream>
+#include <iostream>
#include <sys/stat.h>
#include "imagecache.h"
#include "cairoimage.h"
@@ -42,9 +43,12 @@ void cImageCache::SetPathes(void) {
iconPathTheme = *cString::sprintf("%s%s/themes/%s/", *skinPath, Setup.OSDSkin, Setup.OSDTheme);
skinPartsPathTheme = *cString::sprintf("%s%s/themes/%s/skinparts/", *skinPath, Setup.OSDSkin, Setup.OSDTheme);
+ svgTemplatePath = *cString::sprintf("%s%s/svgtemplates/", *skinPath, Setup.OSDSkin);
+
dsyslog("skindesigner: using channel logo path %s", logoPath.c_str());
dsyslog("skindesigner: using icon path %s", iconPathTheme.c_str());
dsyslog("skindesigner: using skinparts path %s", skinPartsPathTheme.c_str());
+ dsyslog("skindesigner: using svgtemplate path %s", svgTemplatePath.c_str());
}
void cImageCache::CacheLogo(int width, int height) {
@@ -381,8 +385,18 @@ bool cImageCache::LoadIcon(eImageType type, string name) {
if (FileExists(*subIconSkinPath, name, "svg"))
return LoadImage(*subIconSkinPath, name, "svg");
- else
+ else if (FileExists(*subIconSkinPath, name, "png"))
return LoadImage(*subIconSkinPath, name, "png");
+
+ //and finally check if a svg template exists
+ cSVGTemplate svgTemplate(name, svgTemplatePath);
+ if (!svgTemplate.Exists())
+ return false;
+ svgTemplate.ReadTemplate();
+ if (!svgTemplate.ParseTemplate())
+ return false;
+ string tmpImageName = svgTemplate.WriteImage();
+ return LoadImage(tmpImageName.c_str());
}
bool cImageCache::LoadLogo(const cChannel *channel) {
@@ -422,8 +436,18 @@ bool cImageCache::LoadSkinpart(string name) {
else if (FileExists(skinPartsPathSkin.c_str(), name, "svg"))
return LoadImage(skinPartsPathSkin.c_str(), name, "svg");
- else
+ else if (FileExists(skinPartsPathSkin.c_str(), name, "png"))
return LoadImage(skinPartsPathSkin.c_str(), name, "png");
+
+ //check if a svg template exists
+ cSVGTemplate svgTemplate(name, svgTemplatePath);
+ if (!svgTemplate.Exists())
+ return false;
+ svgTemplate.ReadTemplate();
+ if (!svgTemplate.ParseTemplate())
+ return false;
+ string tmpImageName = svgTemplate.WriteImage();
+ return LoadImage(tmpImageName.c_str());
}
void cImageCache::Clear(void) {