summaryrefslogtreecommitdiff
path: root/dvbspu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-01-02 15:29:49 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-01-02 15:29:49 +0100
commitab177a1579371aef6d03c11509717cdf6855b8d7 (patch)
tree1b397bea0665da0c1df99fd69f16cd5a815538e7 /dvbspu.c
parent0b3a801ab463186519e9e1c14ea891924c64dff5 (diff)
downloadvdr-ab177a1579371aef6d03c11509717cdf6855b8d7.tar.gz
vdr-ab177a1579371aef6d03c11509717cdf6855b8d7.tar.bz2
Fixed reusing OSD in cDvbSpuDecoder
Diffstat (limited to 'dvbspu.c')
-rw-r--r--dvbspu.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/dvbspu.c b/dvbspu.c
index 69611392..3c17e563 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.8 2004/11/06 11:50:13 kls Exp $
+ * $Id: dvbspu.c 1.9 2005/01/02 15:27:07 kls Exp $
*/
#include <assert.h>
@@ -349,6 +349,20 @@ sDvbSpuRect cDvbSpuDecoder::CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDv
return size;
}
+static bool OsdMatchesArea(cOsd *osd, tArea &area)
+{
+ cBitmap *bmp = osd->GetBitmap(0);
+ if (!bmp)
+ return false;
+ if (bmp->Bpp() != area.bpp)
+ return false;
+ if (bmp->X0() != area.x1 || bmp->Y0() != area.y1)
+ return false;
+ if (bmp->Width() != area.Width() || bmp->Height() != area.Height())
+ return false;
+ return true;
+}
+
void cDvbSpuDecoder::Draw(void)
{
if (!spubmp) {
@@ -386,12 +400,16 @@ void cDvbSpuDecoder::Draw(void)
}
if (bg || fg) {
+ int x2 = areaSize.x2;
+ while ((x2 - areaSize.x1 + 1) & 0x03)
+ x2++;
+ tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 };
+ if (osd && !OsdMatchesArea(osd, Area)) {
+ delete osd;
+ osd = NULL;
+ }
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);
}