diff options
Diffstat (limited to 'coreengine/osdwrapper.c')
-rw-r--r-- | coreengine/osdwrapper.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/coreengine/osdwrapper.c b/coreengine/osdwrapper.c index 011ffc8..0bd1e01 100644 --- a/coreengine/osdwrapper.c +++ b/coreengine/osdwrapper.c @@ -3,6 +3,8 @@ cSdOsd::cSdOsd(void) { osd = NULL; flushLocked = false; + animsRunning = 0; + animsFlushed = 0; } cSdOsd::~cSdOsd(void) { @@ -48,6 +50,10 @@ void cSdOsd::DeleteOsd(void) { delete osd; osd = NULL; Unlock(); + animsRunningMutex.Lock(); + animsRunning = 0; + animsFlushed = 0; + animsRunningMutex.Unlock(); } cPixmap *cSdOsd::CreatePixmap(int layer, cRect &viewPort, cRect &drawPort) { @@ -63,7 +69,33 @@ void cSdOsd::DestroyPixmap(cPixmap *pix) { } } +void cSdOsd::AddAnimation(void) { + animsRunningMutex.Lock(); + animsRunning++; + animsRunningMutex.Unlock(); +} + +void cSdOsd::RemoveAnimation(void) { + animsRunningMutex.Lock(); + animsRunning--; + animsRunningMutex.Unlock(); +} + +void cSdOsd::AnimatedFlush(void) { + if (osd && !flushLocked) { + animsRunningMutex.Lock(); + if (animsFlushed + 1 >= animsRunning) { + animsFlushed = 0; + osd->Flush(); + } else { + animsFlushed++; + } + animsRunningMutex.Unlock(); + } +} + void cSdOsd::Flush(void) { - if (osd && !flushLocked) + if (osd && !flushLocked) { osd->Flush(); + } } |