diff options
author | lordjaxom <lordjaxom> | 2004-06-01 17:27:26 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2004-06-01 17:27:26 +0000 |
commit | 37b57e7872214cc59119faf29bd058362504b3f6 (patch) | |
tree | 91ac522daad78b4f6498559845c0c3457fd9061e | |
parent | b968a310699595ff139278440ae278aebf112c1f (diff) | |
download | vdr-plugin-text2skin-37b57e7872214cc59119faf29bd058362504b3f6.tar.gz vdr-plugin-text2skin-37b57e7872214cc59119faf29bd058362504b3f6.tar.bz2 |
- fixed some possible segfaults in Display Updatev0.0.1-rc2
- fixed segfault in Timebar when EPG doesn't contain time and duration
- fixed "too many colors used in palette" warning (only with HAVE_IMLIB2=1)
in channel display
- fixed above message in full menu
- removed some debug printf's
-rw-r--r-- | HISTORY | 9 | ||||
-rw-r--r-- | bitmap.c | 13 | ||||
-rw-r--r-- | bitmap.h | 4 | ||||
-rw-r--r-- | display.c | 33 | ||||
-rw-r--r-- | render.c | 25 | ||||
-rw-r--r-- | render.h | 6 | ||||
-rw-r--r-- | text2skin.c | 4 |
7 files changed, 55 insertions, 39 deletions
@@ -1,6 +1,15 @@ VDR Plugin 'text2skin' Revision History --------------------------------------- +2004-06-01: Version 0.0.1-rc2 + +- fixed some possible segfaults in Display Update +- fixed segfault in Timebar when EPG doesn't contain time and duration +- fixed "too many colors used in palette" warning (only with HAVE_IMLIB2=1) + in channel display +- fixed above message in full menu +- removed some debug printf's + 2004-05-31: Version 0.0.1-rc1 - "Background" may be initialized with a color now @@ -1,5 +1,5 @@ /* - * $Id: bitmap.c,v 1.3 2004/05/31 19:54:12 lordjaxom Exp $ + * $Id: bitmap.c,v 1.5 2004/06/01 17:10:13 lordjaxom Exp $ */ #define __STL_CONFIG_H @@ -24,11 +24,12 @@ cText2SkinBitmap::~cText2SkinBitmap() { bool cText2SkinBitmap::Load(const char *Filename) { int len = strlen(Filename); if (len > 4) { +#ifndef HAVE_IMLIB2 if (strcmp(Filename + len - 4, ".xpm") == 0) return LoadXpm(Filename); -#ifdef HAVE_IMLIB2 - else if (strcmp(Filename + len - 4, ".png") == 0) - return LoadPng(Filename); +#else + if (strcmp(Filename + len - 4, ".xpm") == 0 || strcmp(Filename + len - 4, ".png") == 0) + return LoadImlib(Filename); #endif else esyslog("ERROR: text2skin: unknown file format for %s", Filename); @@ -38,14 +39,14 @@ bool cText2SkinBitmap::Load(const char *Filename) { } #ifdef HAVE_IMLIB2 -bool cText2SkinBitmap::LoadPng(const char *Filename) { +bool cText2SkinBitmap::LoadImlib(const char *Filename) { Imlib_Image image; image = imlib_load_image(Filename); if (!image) return false; imlib_context_set_image(image); SetSize(imlib_image_get_width(), imlib_image_get_height()); - SetBpp(4); + SetBpp(8); uint8_t *data = (uint8_t*)imlib_image_get_data_for_reading_only(); int pal = 0, pos = 0; for (int y = 0; y < Height(); ++y) { @@ -1,5 +1,5 @@ /* - * $Id: bitmap.h,v 1.3 2004/05/31 19:54:12 lordjaxom Exp $ + * $Id: bitmap.h,v 1.4 2004/06/01 17:10:13 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_BITMAP_H @@ -17,7 +17,7 @@ public: bool Load(const char *Filename); #ifdef HAVE_IMLIB2 - bool LoadPng(const char *Filename); + bool LoadImlib(const char *Filename); #endif }; @@ -1,5 +1,5 @@ /* - * $Id: display.c,v 1.6 2004/05/31 19:54:12 lordjaxom Exp $ + * $Id: display.c,v 1.8 2004/06/01 17:25:38 lordjaxom Exp $ */ #include "render.h" @@ -9,7 +9,6 @@ // --- cText2SkinDisplayChannel ----------------------------------------------- cText2SkinDisplayChannel::cText2SkinDisplayChannel(cText2SkinData *Data, bool WithInfo) { - printf("cText2SkinDisplayChannel\n"); mData = Data; mWithInfo = WithInfo; mRender = new cText2SkinRender(mData, WithInfo ? sectionChannel : sectionChannelSmall); @@ -21,7 +20,6 @@ cText2SkinDisplayChannel::~cText2SkinDisplayChannel() { } void cText2SkinDisplayChannel::SetChannel(const cChannel *Channel, int Number) { - printf("SetChannel\n"); if (mRender->mChannel != Channel || mRender->mChannelNumber != Number) { mRender->mChannel = Channel; mRender->mChannelNumber = Number; @@ -48,7 +46,6 @@ void cText2SkinDisplayChannel::SetMessage(eMessageType Type, const char *Text) { void cText2SkinDisplayChannel::Flush(void) { if (mDirty) { - printf("real flush\n"); mRender->Flush(); mDirty = false; } @@ -57,7 +54,6 @@ void cText2SkinDisplayChannel::Flush(void) { // --- cText2SkinDisplayVolume ------------------------------------------------ cText2SkinDisplayVolume::cText2SkinDisplayVolume(cText2SkinData *Data) { - printf("cText2SkinDisplayVolume\n"); mData = Data; mRender = new cText2SkinRender(mData, sectionVolume); mDirty = false; @@ -78,7 +74,6 @@ void cText2SkinDisplayVolume::SetVolume(int Current, int Total, bool Mute) { void cText2SkinDisplayVolume::Flush(void) { if (mDirty) { - printf("real flush\n"); mRender->Flush(); mDirty = false; } @@ -87,7 +82,6 @@ void cText2SkinDisplayVolume::Flush(void) { // --- cText2SkinDisplayReplay ------------------------------------------------ cText2SkinDisplayReplay::cText2SkinDisplayReplay(cText2SkinData *Data, bool ModeOnly) { - printf("cText2SkinDisplayReplay\n"); mData = Data; mRender = new cText2SkinRender(mData, ModeOnly ? sectionReplayMode : sectionReplay); mDirty = false; @@ -98,6 +92,7 @@ cText2SkinDisplayReplay::~cText2SkinDisplayReplay() { } void cText2SkinDisplayReplay::SetTitle(const char *Title) { + if (Title == NULL) Title = ""; if (mRender->mReplayTitle != Title) { mRender->mReplayTitle = Title; mDirty = true; @@ -122,7 +117,6 @@ void cText2SkinDisplayReplay::SetProgress(int Current, int Total) { } void cText2SkinDisplayReplay::SetMarks(const cMarks *Marks) { - printf("SetMarks: %p\n", Marks); if (mRender->mReplayMarks != Marks) { mRender->mReplayMarks = Marks; mDirty = true; @@ -130,6 +124,7 @@ void cText2SkinDisplayReplay::SetMarks(const cMarks *Marks) { } void cText2SkinDisplayReplay::SetCurrent(const char *Current) { + if (Current == NULL) Current = ""; if (mRender->mReplayCurrentText != Current) { mRender->mReplayCurrentText = Current; mDirty = true; @@ -137,6 +132,7 @@ void cText2SkinDisplayReplay::SetCurrent(const char *Current) { } void cText2SkinDisplayReplay::SetTotal(const char *Total) { + if (Total == NULL) Total = ""; if (mRender->mReplayTotalText != Total) { mRender->mReplayTotalText = Total; mDirty = true; @@ -162,7 +158,6 @@ void cText2SkinDisplayReplay::SetMessage(eMessageType Type, const char *Text) { void cText2SkinDisplayReplay::Flush(void) { if (mDirty) { - printf("real flush\n"); mRender->Flush(); mDirty = false; } @@ -171,7 +166,6 @@ void cText2SkinDisplayReplay::Flush(void) { // --- cText2SkinDisplayMessage ----------------------------------------------- cText2SkinDisplayMessage::cText2SkinDisplayMessage(cText2SkinData *Data) { - printf("cText2SkinDisplayMessage\n"); mData = Data; mRender = new cText2SkinRender(mData, sectionMessage); mDirty = false; @@ -192,7 +186,6 @@ void cText2SkinDisplayMessage::SetMessage(eMessageType Type, const char *Text) { void cText2SkinDisplayMessage::Flush(void) { if (mDirty) { - printf("real flush\n"); mRender->Flush(); mDirty = false; } @@ -201,7 +194,6 @@ void cText2SkinDisplayMessage::Flush(void) { // --- cText2SkinDisplayMenu -------------------------------------------------- cText2SkinDisplayMenu::cText2SkinDisplayMenu(cText2SkinData *Data) { - printf("cText2SkinDisplayMenu\n"); mData = Data; mRender = new cText2SkinRender(mData, sectionMenu); mDirty = false; @@ -226,6 +218,7 @@ void cText2SkinDisplayMenu::Clear(void) { } void cText2SkinDisplayMenu::SetTitle(const char *Title) { + if (Title == NULL) Title = ""; if (mRender->mMenuTitle != Title) { mRender->mMenuTitle = Title; mDirty = true; @@ -247,7 +240,6 @@ void cText2SkinDisplayMenu::SetButtons(const char *Red, const char *Green, const } void cText2SkinDisplayMenu::SetMessage(eMessageType Type, const char *Text) { - printf("SetMessage: %d, %s\n", Type, Text); if (Text == NULL) Text = ""; if (mRender->mMessageType != Type || mRender->mMessageText != Text) { mRender->mMessageType = Type; @@ -272,17 +264,30 @@ void cText2SkinDisplayMenu::SetItem(const char *Text, int Index, bool Current, b } void cText2SkinDisplayMenu::SetEvent(const cEvent *Event) { + if (mRender->mMenuEvent != Event) { + mRender->mMenuEvent = Event; + mDirty = true; + } } void cText2SkinDisplayMenu::SetRecording(const cRecording *Recording) { + if (mRender->mMenuRecording != Recording) { + mRender->mMenuRecording = Recording; + mDirty = true; + } } void cText2SkinDisplayMenu::SetText(const char *Text, bool FixedFont) { + if (Text == NULL) Text = ""; + if (mRender->mMenuText != Text || mRender->mMenuTextFixedFont != FixedFont) { + mRender->mMenuText = Text; + mRender->mMenuTextFixedFont = FixedFont; + mDirty = true; + } } void cText2SkinDisplayMenu::Flush(void) { if (mDirty) { - printf("real flush\n"); mRender->Flush(); mDirty = false; } @@ -1,5 +1,5 @@ /* - * $Id: render.c,v 1.10 2004/05/31 19:54:12 lordjaxom Exp $ + * $Id: render.c,v 1.14 2004/06/01 17:25:38 lordjaxom Exp $ */ #include "render.h" @@ -16,8 +16,6 @@ cText2SkinRender::cText2SkinRender(cText2SkinData *Data, eSkinSection Section) { tArea areas[MAXOSDAREAS]; int numAreas = 0; - printf("Section: %d\n",Section); - mData = Data; mSection = Section; mOsd = cOsdProvider::NewOsd(Setup.OSDLeft, Setup.OSDTop); @@ -36,12 +34,14 @@ cText2SkinRender::cText2SkinRender(cText2SkinData *Data, eSkinSection Section) { mChannelPresent = NULL; mChannelFollowing = NULL; mMenuCurrent = 0; + mMenuEvent = NULL; + mMenuRecording = NULL; + mMenuTextFixedFont = false; cText2SkinItem *item; for (item = Data->First(); item; item = Data->Next(item)) { if (item->Section() == Section && item->Item() == itemBackground) { if (numAreas < MAXOSDAREAS) { - printf("area item: %d:%d:%d:%d:%d\n", item->Pos().x, item->Pos().y, item->Pos().x + item->Size().w - 1, item->Pos().y + item->Size().h - 1, item->Bpp()); areas[numAreas].x1 = item->Pos().x; areas[numAreas].y1 = item->Pos().y; areas[numAreas].x2 = item->Pos().x + item->Size().w - 1; @@ -177,7 +177,6 @@ void cText2SkinRender::Flush(void) { } } } - printf("osd flush\n"); mOsd->Flush(); } @@ -209,7 +208,7 @@ void cText2SkinRender::DrawImage(const POINT &Pos, const SIZE &Size, const tColo if (bm.Load(p)) { if (Bg) bm.SetColor(0, *Bg); if (Fg) bm.SetColor(1, *Fg); - mOsd->DrawRectangle(Pos.x, Pos.y, Pos.x + Size.w - 1, Pos.y + Size.h - 1, bm.Color(0)); + //mOsd->DrawRectangle(Pos.x, Pos.y, Pos.x + Size.w - 1, Pos.y + Size.h - 1, bm.Color(0)); mOsd->DrawBitmap(Pos.x, Pos.y, bm); } free(p); @@ -314,7 +313,6 @@ void cText2SkinRender::DisplayChannelLogo(cText2SkinItem *Item) { } void cText2SkinRender::DisplayLanguage(cText2SkinItem *Item) { - printf("DisplayLanguage, %s %s\n", Item->Path().c_str(), Item->Type().c_str()); int current; const char **tracks = cDevice::PrimaryDevice()->GetAudioTracks(¤t); if (Item->Path() != "" && Item->Type() != "" && tracks) { @@ -331,12 +329,10 @@ void cText2SkinRender::DisplayLanguage(cText2SkinItem *Item) { } void cText2SkinRender::DisplayText(cText2SkinItem *Item) { - printf("DisplayText\n"); DrawText(Item->Pos(), Item->Size(), Item->Fg(), Item->Text(), Item->Font(), Item->Align()); } void cText2SkinRender::DisplayImage(cText2SkinItem *Item) { - printf("DisplayImage\n"); DrawImage(Item->Pos(), Item->Size(), Item->Bg(), Item->Fg(), Item->Path()); } @@ -349,7 +345,6 @@ void cText2SkinRender::DisplayDate(cText2SkinItem *Item) { char *text = strdup(DayDateTime(time(NULL))); text[9] = '.'; text[10] = '\0'; - printf("DisplayDate %d:%d:%d:%d %s\n", Item->Pos().x, Item->Pos().y, Item->Size().w, Item->Size().h, text + 4); DrawText(Item->Pos(), Item->Size(), Item->Fg(), ItemText(Item, text + 4), Item->Font(), Item->Align()); free(text); } @@ -387,7 +382,7 @@ void cText2SkinRender::DisplaySlope(cText2SkinItem *Item) { void cText2SkinRender::DisplayTimebar(cText2SkinItem *Item) { time_t now = time(NULL); - if (mChannelPresent && now > mChannelPresent->StartTime()) { + if (mChannelPresent && mChannelPresent->StartTime() && mChannelPresent->Duration() && now > mChannelPresent->StartTime()) { int total = mChannelPresent->Duration(); int current = now - mChannelPresent->StartTime(); DrawProgressbar(Item->Pos(), Item->Size(), current, total, Item->Bg(), Item->Fg()); @@ -544,12 +539,14 @@ void cText2SkinRender::DisplayMenuItems(cText2SkinItem *Item) { if (Item->Pos().y != -1) yoffs += Item->Pos().y; - printf("menu items\n"); - int index = 0; while (yoffs < area->Pos().y + area->Size().h && index < (int)mMenuItems.size()) { if (index == mMenuCurrent) { - POINT pt = { xoffs + current->Pos().x, yoffs + current->Pos().y }; + POINT pt = { xoffs, yoffs }; + if (current->Pos().x != -1) + pt.x += current->Pos().x; + if (current->Pos().y != -1) + pt.y += current->Pos().y; SIZE size = { current->Size().w, current->Size().h }; if (current->Bg()) DrawRectangle(pt, size, current->Bg()); @@ -1,5 +1,5 @@ /* - * $Id: render.h,v 1.10 2004/05/31 19:54:12 lordjaxom Exp $ + * $Id: render.h,v 1.11 2004/06/01 14:32:46 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_RENDER_H @@ -71,6 +71,10 @@ private: string mMenuGreen; string mMenuYellow; string mMenuBlue; + const cEvent *mMenuEvent; + const cRecording *mMenuRecording; + string mMenuText; + bool mMenuTextFixedFont; protected: // Basic operations diff --git a/text2skin.c b/text2skin.c index 6ca2f97..4163b18 100644 --- a/text2skin.c +++ b/text2skin.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: text2skin.c,v 1.5 2004/05/31 19:55:51 lordjaxom Exp $ + * $Id: text2skin.c,v 1.6 2004/06/01 16:47:47 lordjaxom Exp $ */ #define __STL_CONFIG_H @@ -11,7 +11,7 @@ #undef __STL_CONFIG_H #include "loader.h" -static const char *VERSION = "0.0.1-rc1"; +static const char *VERSION = "0.0.1-rc2"; static const char *DESCRIPTION = "Loader for text-based skins"; class cText2SkinPlugin : public cPlugin { |