summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <tobias@e-tobi.loc>2009-01-04 18:28:11 +0100
committerTobias Grimm <tobias@e-tobi.loc>2009-01-04 18:28:11 +0100
commit98201a101c54081eea25d2dcc66b0644b7bc8f5d (patch)
tree9d53bd43b18b56429a1082b9d6fb173a012900fb
parentae693f3f070375035f55bee91f0ec891762bcf8d (diff)
downloadvdr-plugin-ttxtsubs-98201a101c54081eea25d2dcc66b0644b7bc8f5d.tar.gz
vdr-plugin-ttxtsubs-98201a101c54081eea25d2dcc66b0644b7bc8f5d.tar.bz2
Fixed displaying of multiple rows when antialiasing is enabled by aquiring a single OSD area for all rows - Thx to Rolf Ahrenberg (Closes #24)
-rw-r--r--HISTORY2
-rw-r--r--ttxtsubsdisplay.c58
2 files changed, 47 insertions, 13 deletions
diff --git a/HISTORY b/HISTORY
index d3c396f..8c2371f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,6 +4,8 @@ VDR Plugin 'ttxtsubs' Revision History
2008-xx.xx: Version 0.x.x
- Updated Italien translation provided by Diego Pierotto
- Updated Russian translation provided by Oleg Roitburd (Closes #47)
+- Fixed displaying of multiple rows when antialiasing is enabled by aquiring a
+ single OSD area for all rows - Thx to Rolf Ahrenberg (Closes #24)
2008-12-18: Version 0.0.7
-Try to set OSDArea to 8 bpp when AntiAliasing is enabled (Closes #17)
diff --git a/ttxtsubsdisplay.c b/ttxtsubsdisplay.c
index cbd7e9d..0ab1e9b 100644
--- a/ttxtsubsdisplay.c
+++ b/ttxtsubsdisplay.c
@@ -443,17 +443,15 @@ void cTtxtSubsDisplay::ShowOSD(void)
rowcount = MAXTTXTROWS;
y = bottom - SCREENTOP - ROWH - ((ROWINCR + globals.lineSpacing()) * (rowcount-1));
- int bpp = 2;
if (Setup.AntiAlias) {
- bpp = 8;
- }
- for(i = 0; i < rowcount; i++) {
- int w = 0;
- int left = SIDEMARGIN;
- w = mOsdFont->Width(buf[i]) + 2 * TEXTX;
- if(w % 4)
- w += 4 - (w % 4);
- switch(globals.textPos()) {
+ // create only one osd area that's big enough for all rows
+ int x1 = SCREENRIGHT+1, x2 = 0, y1 = SCREENBOTTOM+1, y2 = 0;
+ for(i = 0; i < rowcount; i++) {
+ int w = mOsdFont->Width(buf[i]) + 2 * TEXTX;
+ int left = SIDEMARGIN;
+ if(w % 4)
+ w += 4 - (w % 4);
+ switch(globals.textPos()) {
case 1:
left = (SCREENRIGHT - w) / 2;
break;
@@ -461,13 +459,43 @@ void cTtxtSubsDisplay::ShowOSD(void)
left = SCREENRIGHT - SIDEMARGIN - w;
break;
}
- tArea area = {left, y, left+w-1, y+ROWH-1, bpp};
+ if(x1 > left)
+ x1 = left;
+ if(x2 < (left+w-1))
+ x2 = left+w-1;
+ if(y1 > y)
+ y1 = y;
+ if(y2 < (y+ROWH-1))
+ y2 = y+ROWH-1;
+ y += (ROWINCR + globals.lineSpacing());
+ }
+ if((x1 >= x2) || (y1 >= y2)) // validate calculated area
+ return;
+ tArea area = {x1, y1, x2, y2, 8};
areas[numAreas++] = area;
- y += (ROWINCR + globals.lineSpacing());
+ } else {
+ for(i = 0; i < rowcount; i++) {
+ int w = 0;
+ int left = SIDEMARGIN;
+ w = mOsdFont->Width(buf[i]) + 2 * TEXTX;
+ if(w % 4)
+ w += 4 - (w % 4);
+ switch(globals.textPos()) {
+ case 1:
+ left = (SCREENRIGHT - w) / 2;
+ break;
+ case 2:
+ left = SCREENRIGHT - SIDEMARGIN - w;
+ break;
+ }
+ tArea area = {left, y, left+w-1, y+ROWH-1, 2};
+ areas[numAreas++] = area;
+ y += (ROWINCR + globals.lineSpacing());
+ }
}
if (mOsd->CanHandleAreas(areas, numAreas) != oeOk) {
// try lower color depth
- if (bpp > 2) {
+ if (Setup.AntiAlias) {
for(i = 0; i < numAreas; i++) areas[numAreas++].bpp = 2;
if (mOsd->CanHandleAreas(areas, numAreas) != oeOk) {
dprint("ttxtsubs: OSD Cannot handle areas (error code: %d) - try to enlarge the line spacing!\n", mOsd->CanHandleAreas(areas, numAreas));
@@ -477,6 +505,10 @@ void cTtxtSubsDisplay::ShowOSD(void)
}
mOsd->SetAreas(areas, numAreas);
+ for (i = 0; i < numAreas; i++) {
+ mOsd->DrawRectangle(areas[i].x1, areas[i].y1, areas[i].x2, areas[i].y2, clrTransparent);
+ }
+
y = bottom - SCREENTOP - ROWH - ((ROWINCR + globals.lineSpacing()) * (rowcount-1));
for(i = 0; i < rowcount; i++) {
int w = 0;