1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed the cDvbSpuDecoder

This commit is contained in:
Klaus Schmidinger 2004-11-06 11:59:19 +01:00
parent 0e79c2d76e
commit c3e52f8da9
4 changed files with 54 additions and 25 deletions

View File

@ -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 <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -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).

View File

@ -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 <assert.h>
@ -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)
{
if (!spubmp) {
Hide();
if (!spubmp)
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 || !bg || !osd) {
Hide();
}
if (fg)
DrawBmp(hlsize, fg);
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();
}

View File

@ -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();