mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
optimized shifting
This commit is contained in:
parent
11f5697032
commit
858b489cfb
@ -14,6 +14,7 @@ cAnimation::cAnimation(cScrollable *scrollable) : cThread("scroller") {
|
||||
keepSleeping = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
doFlush = true;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
@ -27,6 +28,7 @@ cAnimation::cAnimation(cDetachable *detachable, bool wait, bool animation) : cTh
|
||||
keepSleeping = false;
|
||||
doAnimation = animation;
|
||||
modeIn = false;
|
||||
doFlush = true;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
@ -40,10 +42,11 @@ cAnimation::cAnimation(cFadable *fadable, bool fadein) : cThread("fadable") {
|
||||
keepSleeping = false;
|
||||
doAnimation = true;
|
||||
modeIn = fadein;
|
||||
doFlush = true;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin) : cThread("shiftable") {
|
||||
cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin, bool doFlush) : cThread("shiftable") {
|
||||
this->scrollable = NULL;
|
||||
this->detachable = NULL;
|
||||
this->fadable = NULL;
|
||||
@ -55,6 +58,7 @@ cAnimation::cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool s
|
||||
modeIn = shiftin;
|
||||
shiftstart = start;
|
||||
shiftend = end;
|
||||
this->doFlush = doFlush;
|
||||
blinkFunc = -1;
|
||||
}
|
||||
|
||||
@ -68,6 +72,7 @@ cAnimation::cAnimation(cBlinkable *blinkable, int func) : cThread("blinking") {
|
||||
keepSleeping = false;
|
||||
doAnimation = true;
|
||||
modeIn = false;
|
||||
doFlush = true;
|
||||
blinkFunc = func;
|
||||
}
|
||||
|
||||
@ -317,12 +322,14 @@ void cAnimation::Shift(void) {
|
||||
if (delay > 0)
|
||||
Sleep(delay);
|
||||
}
|
||||
|
||||
shiftable->SetStartShifting();
|
||||
uint64_t start = cTimeMs::Now();
|
||||
while (Running() || !modeIn) {
|
||||
uint64_t now = cTimeMs::Now();
|
||||
if (Running() || !modeIn)
|
||||
shiftable->SetPosition(pos, shiftend);
|
||||
if (Running() || !modeIn)
|
||||
if ((Running() || !modeIn) && doFlush)
|
||||
shiftable->Flush();
|
||||
int delta = cTimeMs::Now() - now;
|
||||
if ((Running() || !modeIn) && (delta < frametime)) {
|
||||
@ -347,7 +354,7 @@ void cAnimation::Shift(void) {
|
||||
pos.Set(pos.X() - stepX, pos.Y() - stepY);
|
||||
}
|
||||
}
|
||||
|
||||
shiftable->SetEndShifting();
|
||||
}
|
||||
|
||||
void cAnimation::Blink(void) {
|
||||
|
@ -70,6 +70,8 @@ public:
|
||||
virtual int ShiftTime(void) = 0;
|
||||
virtual int ShiftMode(void) = 0;
|
||||
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false) = 0;
|
||||
virtual void SetStartShifting(void) = 0;
|
||||
virtual void SetEndShifting(void) = 0;
|
||||
virtual void Flush(void) = 0;
|
||||
};
|
||||
|
||||
@ -104,6 +106,7 @@ private:
|
||||
int blinkFunc;
|
||||
cPoint shiftstart;
|
||||
cPoint shiftend;
|
||||
bool doFlush;
|
||||
void Sleep(int duration);
|
||||
void Wait(void);
|
||||
void Scroll(void);
|
||||
@ -115,7 +118,7 @@ public:
|
||||
cAnimation(cScrollable *scrollable);
|
||||
cAnimation(cDetachable *detachable, bool wait, bool animation);
|
||||
cAnimation(cFadable *fadable, bool fadein);
|
||||
cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin);
|
||||
cAnimation(cShiftable *shiftable, cPoint &start, cPoint &end, bool shiftin, bool doFlush = true);
|
||||
cAnimation(cBlinkable *blinkable, int func);
|
||||
~cAnimation(void);
|
||||
void WakeUp(void);
|
||||
|
@ -12,6 +12,7 @@ cView::cView(void) {
|
||||
viewElementsHorizontal = NULL;
|
||||
fader = NULL;
|
||||
shifter = NULL;
|
||||
shifting = false;
|
||||
currentTvFrame = NULL;
|
||||
newTvFrame = NULL;
|
||||
menuInit = false;
|
||||
@ -30,6 +31,7 @@ cView::~cView() {
|
||||
free(viewName);
|
||||
delete fader;
|
||||
delete shifter;
|
||||
shifting = false;
|
||||
sdOsd.DeleteOsd();
|
||||
}
|
||||
|
||||
@ -158,6 +160,8 @@ void cView::PreCache(void) {
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
if (!viewElements[i])
|
||||
continue;
|
||||
if (FadeTime() > 0 || ShiftTime() > 0)
|
||||
viewElements[i]->SetAnimatedView();
|
||||
viewElements[i]->SetContainer(contX, contY, attribs->Width(), attribs->Height());
|
||||
viewElements[i]->Cache();
|
||||
}
|
||||
@ -165,6 +169,8 @@ void cView::PreCache(void) {
|
||||
for (int i=0; i < numViewElements; i++) {
|
||||
if (!viewElementsHorizontal[i])
|
||||
continue;
|
||||
if (FadeTime() > 0 || ShiftTime() > 0)
|
||||
viewElementsHorizontal[i]->SetAnimatedView();
|
||||
viewElementsHorizontal[i]->SetContainer(contX, contY, attribs->Width(), attribs->Height());
|
||||
viewElementsHorizontal[i]->Cache();
|
||||
}
|
||||
@ -240,6 +246,7 @@ void cView::Close(void) {
|
||||
continue;
|
||||
viewElements[i]->Close();
|
||||
}
|
||||
sdOsd.Flush();
|
||||
sdOsd.DeleteOsd();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ protected:
|
||||
map<string,int> viewElementNames;
|
||||
cAnimation *fader;
|
||||
cAnimation *shifter;
|
||||
bool shifting;
|
||||
cRect tvFrame;
|
||||
cRect *currentTvFrame;
|
||||
cRect *newTvFrame;
|
||||
@ -88,6 +89,8 @@ public:
|
||||
int ShiftTime(void);
|
||||
int ShiftMode(void);
|
||||
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false);
|
||||
void SetStartShifting(void) { shifting = true; };
|
||||
void SetEndShifting(void) { shifting = false; };
|
||||
};
|
||||
|
||||
#endif //__VIEW_H
|
||||
|
@ -174,24 +174,28 @@ void cViewChannel::Flush(void) {
|
||||
|
||||
if (!displayChannelGroups) {
|
||||
//normal display
|
||||
Render((int)eVeDisplayChannel::channelinfo);
|
||||
Render((int)eVeDisplayChannel::epginfo);
|
||||
Render((int)eVeDisplayChannel::statusinfo);
|
||||
Render((int)eVeDisplayChannel::scrapercontent);
|
||||
Render((int)eVeDisplayChannel::progressbar, channelChange);
|
||||
Render((int)eVeDisplayChannel::screenresolution);
|
||||
Render((int)eVeDisplayChannel::signalquality);
|
||||
Render((int)eVeDisplayChannel::audioinfo);
|
||||
Render((int)eVeDisplayChannel::ecminfo);
|
||||
Render((int)eVeDisplayChannel::devices);
|
||||
Render((int)eVeDisplayChannel::customtokens);
|
||||
Render((int)eVeDisplayChannel::message);
|
||||
if (!shifting) {
|
||||
Render((int)eVeDisplayChannel::channelinfo);
|
||||
Render((int)eVeDisplayChannel::epginfo);
|
||||
Render((int)eVeDisplayChannel::statusinfo);
|
||||
Render((int)eVeDisplayChannel::scrapercontent);
|
||||
Render((int)eVeDisplayChannel::progressbar, channelChange);
|
||||
Render((int)eVeDisplayChannel::screenresolution);
|
||||
Render((int)eVeDisplayChannel::signalquality);
|
||||
Render((int)eVeDisplayChannel::audioinfo);
|
||||
Render((int)eVeDisplayChannel::ecminfo);
|
||||
Render((int)eVeDisplayChannel::devices);
|
||||
Render((int)eVeDisplayChannel::customtokens);
|
||||
Render((int)eVeDisplayChannel::message);
|
||||
}
|
||||
} else {
|
||||
//channelgroup display
|
||||
Render((int)eVeDisplayChannel::channelgroup);
|
||||
}
|
||||
Render((int)eVeDisplayChannel::datetime);
|
||||
Render((int)eVeDisplayChannel::time);
|
||||
if (!shifting) {
|
||||
Render((int)eVeDisplayChannel::datetime);
|
||||
Render((int)eVeDisplayChannel::time);
|
||||
}
|
||||
channelChange = false;
|
||||
cView::Flush();
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ cViewElement::cViewElement(void) {
|
||||
detached = false;
|
||||
waitOnWakeup = true;
|
||||
startAnimation = true;
|
||||
viewAnimated = false;
|
||||
globals = NULL;
|
||||
tokenContainer = NULL;
|
||||
attribs = new cViewElementAttribs((int)eViewElementAttribs::count);
|
||||
@ -34,6 +35,7 @@ cViewElement::cViewElement(const cViewElement &other) {
|
||||
detached = false;
|
||||
waitOnWakeup = true;
|
||||
startAnimation = true;
|
||||
viewAnimated = false;
|
||||
globals = other.globals;
|
||||
container.Set(other.container.X(), other.container.Y(), other.container.Width(), other.container.Height());
|
||||
tokenContainer = NULL;
|
||||
@ -424,7 +426,7 @@ void cViewElement::StartAnimation(void) {
|
||||
SetPosition(start, ref);
|
||||
sdOsd->Flush();
|
||||
delete shifter;
|
||||
shifter = new cAnimation((cShiftable*)this, start, ref, true);
|
||||
shifter = new cAnimation((cShiftable*)this, start, ref, true, !viewAnimated);
|
||||
shifter->Start();
|
||||
} else if (FadeTime() > 0) {
|
||||
SetTransparency(100);
|
||||
|
@ -27,6 +27,7 @@ protected:
|
||||
bool waitOnWakeup;
|
||||
bool scrollingStarted;
|
||||
bool startAnimation;
|
||||
bool viewAnimated;
|
||||
cGlobals *globals;
|
||||
cRect container;
|
||||
cViewElementAttribs *attribs;
|
||||
@ -54,6 +55,7 @@ public:
|
||||
bool Detached(void);
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
void SetAttributes(vector<stringpair> &attributes);
|
||||
void SetAnimatedView(void) { viewAnimated = true; };
|
||||
void AddArea(cAreaNode *area);
|
||||
void SetAreaX(int x);
|
||||
void SetAreaY(int y);
|
||||
@ -84,6 +86,8 @@ public:
|
||||
void StartAnimation(void);
|
||||
virtual void SetTransparency(int transparency, bool force = false);
|
||||
virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false);
|
||||
void SetStartShifting(void) { };
|
||||
void SetEndShifting(void) { };
|
||||
cRect CoveredArea(void);
|
||||
void Flush(void);
|
||||
virtual bool Parse(bool forced = false);
|
||||
|
@ -250,7 +250,7 @@ bool cVeDevices::Parse(bool forced) {
|
||||
if (light)
|
||||
return false;
|
||||
//check if drawing is necessary
|
||||
if (lastRefresh - cTimeMs::Now() < 500)
|
||||
if (cTimeMs::Now() - lastRefresh < 500)
|
||||
return false;
|
||||
bool changed = false;
|
||||
for (int i = 0; i < numDevices; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user