diff options
author | Christian Tusche <chr13@gmx.net> | 2009-06-06 23:17:58 +0200 |
---|---|---|
committer | Thomas Günther <tom@toms-cafe.de> | 2009-06-06 23:17:58 +0200 |
commit | 2a4bf008cd0a14d53fefec0c34573aab12424373 (patch) | |
tree | 12ee1c3021b4965f095b5ea81ab3a60f01217449 /render.h | |
parent | 60cd7db51838bb076312fd10e08bca0f4a005f82 (diff) | |
parent | 3ab2393b6932b34e7f0e69af7f843d1303104d79 (diff) | |
download | vdr-plugin-text2skin-2a4bf008cd0a14d53fefec0c34573aab12424373.tar.gz vdr-plugin-text2skin-2a4bf008cd0a14d53fefec0c34573aab12424373.tar.bz2 |
Added chr13-optimizations (thanks to Christian Tusche / closes #39)
- increased efficiency in drawing list items in the main menu
- introduce relative Pos and Size of objects to given BasePos, BaseSize
(used to draw list items)
- increase skin file version to 1.1
- the position of list items is interpreted relative to the "list" container
when file version >= 1.1
- when a position is specified for "block" elements, the position of all
contained elements is interpreted relative to the container position
- selective update of changed objects
refresh can be controlled for individual objects by the attributes
"refresh" and "changed"
default behaviour is to redraw everything (compatible with old skins)
- moved state tracking of marquee, blink, scroll from cText2SkinRender
to cxObject
- fixed use of Update.Lock() in render.h
- new: dynamic width/height of objects
- new: Option "bgColor" used for items "Text", "Marquee", and "Blink".
- remember period to next timeout when doing a non-timeout refresh
prevent occasional start/stop of marquee-text
Diffstat (limited to 'render.h')
-rw-r--r-- | render.h | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -27,6 +27,7 @@ class cText2SkinRender: public cThread { friend class cText2SkinDisplayReplay; friend class cText2SkinDisplayMessage; friend class cText2SkinDisplayMenu; + friend class cText2SkinDisplayTracks; friend class cText2SkinStatus; @@ -47,7 +48,8 @@ private: tTokenCache mTokenCache; std::string mBasePath; - bool mDirty; + uint mDirty; // bit mask of required updates - set by SetDirty() + std::vector<int> mDirtyItems; uint mMaxItems; cSkin *mFallback; @@ -59,23 +61,15 @@ private: cCondVar mStarted; uint mUpdateIn; uint mNow; // timestamp to calculate update timings + bool mFirst; // First drawing of the display -> draw everything // coordinate transformation txSize mBaseSize; - - // state information for marquee, blink, scroll - struct tState { - bool scrolling; - int offset; - int direction; - uint nexttime; - std::string text; - - tState(void): scrolling(false), offset(0), direction(1), nexttime(0) {} - }; - typedef std::map<uint,tState> tStates; - tStates mStates; - + + // scalefactor for tabs in the menu list + float mTabScale; + bool mTabScaleSet; + protected: // Update thread void UpdateLock(void) { mDoUpdateMutex.Lock(); } @@ -83,17 +77,22 @@ protected: virtual void Action(void); // Drawing operations - void DrawObject(const cxObject *Object); + void DrawObject(cxObject *Object, const txPoint &BaseOffset = txPoint(-1, -1), + const txSize &BaseSize = txSize(-1, -1), const txSize &VirtSize = txSize(-1, -1), + int ListItem = -1, bool ForceUpdate = false); + void DrawItemText(cxObject *o, int i, const txPoint &ListOffset, const txSize &ListSize); + void DrawBackground(const txPoint &Pos, const txSize &Size, const tColor *Bg, const tColor *Fg, int Alpha, const std::string &Path); void DrawImage(const txPoint &Pos, const txSize &Size, const tColor *Bg, const tColor *Fg, const tColor *Mask, int Alpha, int Colors, const std::string &Path); - void DrawText(const txPoint &Pos, const txSize &Size, const tColor *Fg, const std::string &Text, - const cFont *Font, int Align); - void DrawMarquee(const txPoint &Pos, const txSize &Size, const tColor *Fg, - const std::string &Text, const cFont *Font, int Align, uint Delay, uint Index); + void DrawText(const txPoint &Pos, const txSize &Size, const tColor *Fg, const tColor *Bg, + const std::string &Text, const cFont *Font, int Align); + void DrawMarquee(const txPoint &Pos, const txSize &Size, const tColor *Fg, const tColor *Bg, + const std::string &Text, const cFont *Font, int Align, uint Delay, txState &state); void DrawBlink(const txPoint &Pos, const txSize &Size, const tColor *Fg, const tColor *Bg, - const std::string &Text, const cFont *Font, int Align, uint Delay, uint Index); + const tColor *Bl, const std::string &Text, const cFont *Font, int Align, + uint Delay, txState &state); void DrawRectangle(const txPoint &Pos, const txSize &Size, const tColor *Fg); void DrawEllipse(const txPoint &Pos, const txSize &Size, const tColor *Fg, int Arc); void DrawSlope(const txPoint &Pos, const txSize &Size, const tColor *Fg, int Arc); @@ -121,7 +120,7 @@ protected: // functions for display renderer to control behaviour void Flush(bool Force = false); - void SetDirty(void) { mDirty = true; } + void SetDirty(cxRefresh::eRefreshType type = cxRefresh::all) { mDirty |= 1<<type; } void Scroll(bool Up, bool Page) { if (mScroller != NULL) mScroller->Scroll(Up, Page); } void Clear(void) { DELETENULL(mScroller); } cSkin *Fallback(void) const { return mFallback; } @@ -168,14 +167,15 @@ public: inline void cText2SkinRender::Flush(bool Force) { - if (mDirty || Force) { - mTokenCache.clear(); + if (Force) + // do a full redraw + mDirty = (1 << cxRefresh::all); + if (mDirty > 0) { UpdateLock(); + mTokenCache.clear(); mDoUpdate.Broadcast(); UpdateUnlock(); - - mDirty = false; } } |