summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-05-14 10:38:08 +0200
committerlouis <louis.braun@gmx.de>2015-05-14 10:38:08 +0200
commit9a0217589ef98f0af13bd623a6e7870d566779f6 (patch)
tree67eb8e9850b8609ad24e93bd3460d7c0ec914dd2
parent01b09d742440727661d69bed76710b9d79e2c912 (diff)
downloadvdr-plugin-skindesigner-9a0217589ef98f0af13bd623a6e7870d566779f6.tar.gz
vdr-plugin-skindesigner-9a0217589ef98f0af13bd623a6e7870d566779f6.tar.bz2
fixed blinking for animated views
-rw-r--r--HISTORY2
-rw-r--r--libcore/pixmapcontainer.c5
-rw-r--r--libcore/pixmapcontainer.h1
-rw-r--r--views/animation.c2
-rw-r--r--views/animation.h3
-rw-r--r--views/view.c14
6 files changed, 16 insertions, 11 deletions
diff --git a/HISTORY b/HISTORY
index 991bf09..c6a1073 100644
--- a/HISTORY
+++ b/HISTORY
@@ -321,3 +321,5 @@ Version 0.4.5
- fixed bug that detached viewelements were not cleared
correctly
- implemented shiftout for views
+- fixed blinking for animated views
+
diff --git a/libcore/pixmapcontainer.c b/libcore/pixmapcontainer.c
index 0391a64..c60ba54 100644
--- a/libcore/pixmapcontainer.c
+++ b/libcore/pixmapcontainer.c
@@ -344,6 +344,11 @@ void cPixmapContainer::SetDrawPortPoint(int num, const cPoint &Point) {
* to ensure that a proper lock is set before accessing pixmaps
****************************************************************************/
+int cPixmapContainer::AnimationDelay(void) {
+ int animTime = max(shiftTime, fadeTime);
+ return animTime + 100;
+}
+
void cPixmapContainer::FadeIn(void) {
if (!fadeTime) {
for (int i = 0; i < numPixmaps; i++) {
diff --git a/libcore/pixmapcontainer.h b/libcore/pixmapcontainer.h
index 20e2c66..a116da0 100644
--- a/libcore/pixmapcontainer.h
+++ b/libcore/pixmapcontainer.h
@@ -72,6 +72,7 @@ protected:
void SetShiftMode(int mode) { shiftMode = mode; };
void SetStartPos(int posX, int posY) { startPos.SetX(posX); startPos.SetY(posY); };
bool IsAnimated(void) { return (shiftTime > 0); };
+ int AnimationDelay(void);
void FadeIn(void);
void FadeOut(void);
void ShiftIn(void);
diff --git a/views/animation.c b/views/animation.c
index d0ca810..d06a810 100644
--- a/views/animation.c
+++ b/views/animation.c
@@ -3,6 +3,7 @@
using namespace std;
cAnimation::cAnimation(eAnimType animType, int animFreq, cRect &pos, int layer) : cPixmapContainer(1) {
+ delay = 0;
this->animType = animType;
this->animFreq = animFreq;
this->pos = pos;
@@ -16,6 +17,7 @@ cAnimation::~cAnimation() {
void cAnimation::Action(void) {
CreatePixmap(0, layer+1, pos);
bool init = true;
+ DoSleep(delay);
while (Running()) {
if (animType == atBlink) {
if (!blinkOn) {
diff --git a/views/animation.h b/views/animation.h
index 1647872..743c002 100644
--- a/views/animation.h
+++ b/views/animation.h
@@ -8,6 +8,7 @@
using namespace std;
class cAnimation : public cPixmapContainer {
+ int delay;
protected:
eAnimType animType;
int animFreq;
@@ -19,7 +20,7 @@ protected:
public:
cAnimation(eAnimType animType, int animFreq, cRect &pos, int layer);
virtual ~cAnimation();
- void SetAnimationFadeTime(int fadeTime) { SetFadeTime(fadeTime); };
+ void SetDelay(int delay) { this->delay = delay; };
virtual void Stop(void);
};
diff --git a/views/view.c b/views/view.c
index 1b9cc07..b8e5840 100644
--- a/views/view.c
+++ b/views/view.c
@@ -1013,12 +1013,10 @@ void cView::DrawAnimatedImage(int numPix, cTemplateFunction *func, cRect &pos, c
cRect posAnim = CalculateAnimationClip(numPix, pos);
eAnimType animType = (eAnimType)func->GetNumericParameter(ptAnimType);
int animFreq = func->GetNumericParameter(ptAnimFreq);
-
+
cAnimatedImage *anim = new cAnimatedImage(animType, animFreq, posAnim, layer);
animations.insert(pair<int, cAnimation*>(animCat, anim));
- if (tmplView) {
- anim->SetAnimationFadeTime(tmplView->GetNumericParameter(ptFadeTime));
- }
+ anim->SetDelay(AnimationDelay());
anim->SetImage(image);
anim->Start();
}
@@ -1034,9 +1032,7 @@ void cView::DrawAnimatedText(int numPix, cTemplateFunction *func, cPoint &pos, s
cAnimatedText *anim = new cAnimatedText(animType, animFreq, posAnim, layer);
animations.insert(pair<int, cAnimation*>(animCat, anim));
- if (tmplView) {
- anim->SetAnimationFadeTime(tmplView->GetNumericParameter(ptFadeTime));
- }
+ anim->SetDelay(AnimationDelay());
anim->SetText(text);
anim->SetFont(fontName);
anim->SetFontSize(fontSize);
@@ -1053,9 +1049,7 @@ void cView::DrawAnimatedOsdObject(int numPix, cTemplateFunction *func, cRect &po
cAnimatedOsdObject *anim = new cAnimatedOsdObject(funcType, animType, animFreq, posAnim, layer);
animations.insert(pair<int, cAnimation*>(animCat, anim));
- if (tmplView) {
- anim->SetAnimationFadeTime(tmplView->GetNumericParameter(ptFadeTime));
- }
+ anim->SetDelay(AnimationDelay());
anim->SetColor(col);
anim->SetQuadrant(quadrant);
anim->Start();