diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f6240a20..bbcc0db6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1073,6 +1073,7 @@ Marco Schl for reporting a problem with initialization of the main program loop variables with older compiler versions for adding the 'portal name' to cChannels + for fixing the cDvbSpuDecoder Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index b4a547f9..39f53355 100644 --- a/HISTORY +++ b/HISTORY @@ -3126,3 +3126,4 @@ Video Disk Recorder Revision History unsolved problems when running on NPTL systems. - Added missing calls to cStatus::MsgOsdClear() in cSkins::Message() (thanks to Joachim Wilke for reporting this one). +- Fixed the cDvbSpuDecoder (thanks to Marco Schlüßler). diff --git a/dvbspu.c b/dvbspu.c index 184e6863..69611392 100644 --- a/dvbspu.c +++ b/dvbspu.c @@ -8,7 +8,7 @@ * * parts of this file are derived from the OMS program. * - * $Id: dvbspu.c 1.7 2004/05/22 14:02:32 kls Exp $ + * $Id: dvbspu.c 1.8 2004/11/06 11:50:13 kls Exp $ */ #include @@ -319,25 +319,42 @@ int cDvbSpuDecoder::ScaleYres(int value) return value; } -void cDvbSpuDecoder::DrawBmp(sDvbSpuRect & size, cBitmap * bmp) +sDvbSpuRect cDvbSpuDecoder::CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDvbSpuRect bgsize, cBitmap *bgbmp) { - int x2 = size.x2; - while ((x2 - size.x1 + 1) & 0x03) - x2++; - tArea Area = { size.x1, size.y1, x2, size.y2, 2 }; - osd->SetAreas(&Area, 1); - if (x2 > size.x2) - osd->DrawRectangle(size.x2 + 1, size.y1, x2, size.y2, clrTransparent); - osd->DrawBitmap(size.x1, size.y1, *bmp); - delete bmp; + sDvbSpuRect size; + if (fgbmp && bgbmp) { + size.x1 = min(fgsize.x1, bgsize.x1); + size.y1 = min(fgsize.y1, bgsize.y1); + size.x2 = max(fgsize.x2, bgsize.x2); + size.y2 = max(fgsize.y2, bgsize.y2); + } + else if (fgbmp) { + size.x1 = fgsize.x1; + size.y1 = fgsize.y1; + size.x2 = fgsize.x2; + size.y2 = fgsize.y2; + } + else if (bgbmp) { + size.x1 = bgsize.x1; + size.y1 = bgsize.y1; + size.x2 = bgsize.x2; + size.y2 = bgsize.y2; + } + else { + size.x1 = 0; + size.y1 = 0; + size.x2 = 0; + size.y2 = 0; + } + return size; } void cDvbSpuDecoder::Draw(void) { - Hide(); - - if (!spubmp) + if (!spubmp) { + Hide(); return; + } cBitmap *fg = NULL; cBitmap *bg = NULL; @@ -362,18 +379,28 @@ void cDvbSpuDecoder::Draw(void) } } - if (bg || fg) { - if (osd == NULL) - if ((osd = cOsdProvider::NewOsd(0, 0)) == NULL) { - dsyslog("NewOsd failed\n"); - return; - } + sDvbSpuRect areaSize = CalcAreaSize(hlsize, fg, bgsize, bg); - if (fg) - DrawBmp(hlsize, fg); + if (!fg || !bg || !osd) { + Hide(); + } + + if (bg || fg) { + if (osd == NULL) { + osd = cOsdProvider::NewOsd(0, 0); + int x2 = areaSize.x2; + while ((x2 - areaSize.x1 + 1) & 0x03) + x2++; + tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 }; + osd->SetAreas(&Area, 1); + } if (bg) - DrawBmp(bgsize, bg); + osd->DrawBitmap(bgsize.x1, bgsize.y1, *bg); + if (fg) + osd->DrawBitmap(hlsize.x1, hlsize.y1, *fg); + delete fg; + delete bg; osd->Flush(); } diff --git a/dvbspu.h b/dvbspu.h index e0f3d0c6..078f432e 100644 --- a/dvbspu.h +++ b/dvbspu.h @@ -8,7 +8,7 @@ * * parts of this file are derived from the OMS program. * - * $Id: dvbspu.h 1.5 2004/06/12 12:57:55 kls Exp $ + * $Id: dvbspu.h 1.6 2004/11/06 11:42:37 kls Exp $ */ #ifndef __DVBSPU_H @@ -130,7 +130,7 @@ class cDvbSpuDecoder:public cSpuDecoder { int ScaleYcoord(int value); int ScaleYres(int value); - void DrawBmp(sDvbSpuRect & size, cBitmap * bmp); + sDvbSpuRect CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDvbSpuRect bgsize, cBitmap *bgbmp); public: cDvbSpuDecoder();