summaryrefslogtreecommitdiff
path: root/libtemplate
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-11-25 14:33:59 +0100
committerlouis <louis.braun@gmx.de>2014-11-25 14:33:59 +0100
commitd684cec70e72c4f9cea35fda69c1baa32360b5e3 (patch)
tree2655aec65d580e7d9bc7cbeecc7602e96b37799d /libtemplate
parent0422c52c6e679bae3bfd1c293cd11edbe3ae8a9c (diff)
downloadvdr-plugin-skindesigner-d684cec70e72c4f9cea35fda69c1baa32360b5e3.tar.gz
vdr-plugin-skindesigner-d684cec70e72c4f9cea35fda69c1baa32360b5e3.tar.bz2
optimized image caching code
Diffstat (limited to 'libtemplate')
-rw-r--r--libtemplate/template.c55
-rw-r--r--libtemplate/template.h1
2 files changed, 24 insertions, 32 deletions
diff --git a/libtemplate/template.c b/libtemplate/template.c
index 4edbe4a..ef7d677 100644
--- a/libtemplate/template.c
+++ b/libtemplate/template.c
@@ -104,7 +104,6 @@ vector< pair<string, int> > cTemplate::GetUsedFonts(void) {
void cTemplate::CacheImages(void) {
CacheImages(rootView);
-
rootView->InitSubViewIterator();
cTemplateView *subView = NULL;
while(subView = rootView->GetNextSubView()) {
@@ -113,9 +112,7 @@ void cTemplate::CacheImages(void) {
}
void cTemplate::Debug(void) {
-
rootView->Debug();
-
}
/*******************************************************************
@@ -213,13 +210,7 @@ void cTemplate::CacheImages(cTemplateView *view) {
viewElement->InitIterator();
cTemplatePixmap *pix = NULL;
while(pix = viewElement->GetNextPixmap()) {
- pix->InitIterator();
- cTemplateFunction *func = NULL;
- while(func = pix->GetNextFunction()) {
- if (func->GetType() == ftDrawImage) {
- CacheImage(func);
- }
- }
+ CachePixmapImages(pix);
}
}
//used images in viewLists pixmaps
@@ -229,40 +220,40 @@ void cTemplate::CacheImages(cTemplateView *view) {
viewList->InitIterator();
cTemplatePixmap *pix = NULL;
while(pix = viewList->GetNextPixmap()) {
- pix->InitIterator();
- cTemplateFunction *func = NULL;
- while(func = pix->GetNextFunction()) {
- if (func->GetType() == ftDrawImage) {
- CacheImage(func);
- }
- }
+ CachePixmapImages(pix);
}
cTemplateViewElement *listElement = viewList->GetListElement();
listElement->InitIterator();
while(pix = listElement->GetNextPixmap()) {
- pix->InitIterator();
- cTemplateFunction *func = NULL;
- while(func = pix->GetNextFunction()) {
- if (func->GetType() == ftDrawImage) {
- CacheImage(func);
- }
- }
+ CachePixmapImages(pix);
+ }
+ cTemplateViewElement *currentElement = viewList->GetListElementCurrent();
+ if (!currentElement) {
+ continue;
+ }
+ currentElement->InitIterator();
+ while(pix = currentElement->GetNextPixmap()) {
+ CachePixmapImages(pix);
}
}
- //used logos in viewTabs
+ //used images in viewTabs
view->InitViewTabIterator();
cTemplateViewTab *viewTab = NULL;
while(viewTab = view->GetNextViewTab()) {
- viewTab->InitIterator();
- cTemplateFunction *func = NULL;
- while(func = viewTab->GetNextFunction()) {
- if (func->GetType() == ftDrawImage) {
- CacheImage(func);
- }
- }
+ CachePixmapImages(viewTab);
}
}
+void cTemplate::CachePixmapImages(cTemplatePixmap *pix) {
+ pix->InitIterator();
+ cTemplateFunction *func = NULL;
+ while(func = pix->GetNextFunction()) {
+ if (func->GetType() == ftDrawImage) {
+ CacheImage(func);
+ }
+ }
+}
+
void cTemplate::CacheImage(cTemplateFunction *func) {
eImageType imgType = (eImageType)func->GetNumericParameter(ptImageType);
int width = func->GetNumericParameter(ptWidth);
diff --git a/libtemplate/template.h b/libtemplate/template.h
index a4ef238..2c1cfb2 100644
--- a/libtemplate/template.h
+++ b/libtemplate/template.h
@@ -32,6 +32,7 @@ enum eViewType {
class cTemplate {
private:
eViewType viewType;
+ void CachePixmapImages(cTemplatePixmap *pix);
void CacheImage(cTemplateFunction *func);
protected:
cGlobals *globals;