fixed blinking for animated views

This commit is contained in:
louis 2015-05-14 10:38:08 +02:00
parent 01b09d7424
commit 9a0217589e
6 changed files with 16 additions and 11 deletions

View File

@ -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

View File

@ -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++) {

View File

@ -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);

View File

@ -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) {

View File

@ -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);
};

View File

@ -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();