From 5f9f793d7b629888f2f729a088c6ee8c33ad042b Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 10 Feb 2008 10:10:44 +0100 Subject: [PATCH] Fixed setting the date in the channel display of the classic and sttng skins, to avoid unnecessary OSD access --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ skinclassic.c | 13 +++++++++---- skinsttng.c | 10 +++++++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4bd828b2..d70fb861 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1449,6 +1449,8 @@ Marco Schl an example ~cMyReceiver() in PLUGINS.html (thanks to Marco Schlüßler). for fixing checking compatibility mode for old subtitles plugin for a patch that was used to implement handling of DVB-S2 + for fixing setting the date in the channel display of the classic and sttng skins, + to avoid unnecessary OSD access Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 120fa890..655f68d7 100644 --- a/HISTORY +++ b/HISTORY @@ -5603,3 +5603,5 @@ Video Disk Recorder Revision History accessing file handles after they have become invalid (thanks to Reinhard Nissl for reporting an invalid access when ending VDR, and to Deti Fliegl for a patch that was used to implement StopSectionHandler()). +- Fixed setting the date in the channel display of the classic and sttng skins, + to avoid unnecessary OSD access (thanks to Marco Schlüßler). diff --git a/skinclassic.c b/skinclassic.c index 11b5ce44..13a6c896 100644 --- a/skinclassic.c +++ b/skinclassic.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinclassic.c 1.19 2008/01/13 12:38:00 kls Exp $ + * $Id: skinclassic.c 1.20 2008/02/10 10:01:13 kls Exp $ */ #include "skinclassic.h" @@ -77,6 +77,7 @@ private: int lineHeight; int timeWidth; bool message; + cString lastDate; public: cSkinClassicDisplayChannel(bool WithInfo); virtual ~cSkinClassicDisplayChannel(); @@ -113,6 +114,7 @@ void cSkinClassicDisplayChannel::SetChannel(const cChannel *Channel, int Number) { osd->DrawRectangle(0, 0, osd->Width() - 1, lineHeight - 1, Theme.Color(clrBackground)); osd->DrawText(2, 0, ChannelString(Channel, Number), Theme.Color(clrChannelName), Theme.Color(clrBackground), cFont::GetFont(fontOsd)); + lastDate = NULL; } void cSkinClassicDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following) @@ -147,9 +149,12 @@ void cSkinClassicDisplayChannel::Flush(void) { if (!message) { cString date = DayDateTime(); - const cFont *font = cFont::GetFont(fontSml); - int w = font->Width(date); - osd->DrawText(osd->Width() - w - 2, 0, date, Theme.Color(clrChannelDate), Theme.Color(clrBackground), cFont::GetFont(fontSml), w); + if (!lastDate || strcmp(date, lastDate)) { + const cFont *font = cFont::GetFont(fontSml); + int w = font->Width(date); + osd->DrawText(osd->Width() - w - 2, 0, date, Theme.Color(clrChannelDate), Theme.Color(clrBackground), cFont::GetFont(fontSml), w); + lastDate = date; + } } osd->Flush(); } diff --git a/skinsttng.c b/skinsttng.c index 4f576a7c..54638864 100644 --- a/skinsttng.c +++ b/skinsttng.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinsttng.c 1.21 2007/06/17 13:51:56 kls Exp $ + * $Id: skinsttng.c 1.22 2008/02/10 10:05:40 kls Exp $ */ // Star Trek: The Next Generation® is a registered trademark of Paramount Pictures @@ -129,6 +129,7 @@ private: tColor frameColor; bool message; const cEvent *present; + cString lastDate; int lastSeen; tTrackId lastTrackId; static cBitmap bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording; @@ -307,7 +308,10 @@ void cSkinSTTNGDisplayChannel::Flush(void) const cFont *font = cFont::GetFont(fontSml); cString date = DayDateTime(); int w = font->Width(date); - osd->DrawText(x4 - w - 2, y7 - font->Height(), date, Theme.Color(clrChannelDate), frameColor, font, w); + if (!lastDate || strcmp(date, lastDate)) { + osd->DrawText(x4 - w - 2, y7 - font->Height(), date, Theme.Color(clrChannelDate), frameColor, font, w); + lastDate = date; + } cDevice *Device = cDevice::PrimaryDevice(); const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack()); if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) { @@ -325,7 +329,7 @@ void cSkinSTTNGDisplayChannel::Flush(void) if (seen != lastSeen) { osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y4 - 1, Theme.Color(clrChannelTimebarRest)); if (seen) - osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y3 + seen, Theme.Color(clrChannelTimebarSeen)); + osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y3 + seen, Theme.Color(clrChannelTimebarSeen)); lastSeen = seen; } }