From c281d01c089f4c9410a2756d3bcd99a56f702c86 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 6 Jun 2004 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.10=20-=20Fixed=20some=20default=20paramet?= =?UTF-8?q?ers=20in=20'skincurses'.=20-=20Fixed=20cBitmap::DrawPixel(),=20?= =?UTF-8?q?which=20messed=20with=20other=20bitmaps'=20palettes=20in=20case?= =?UTF-8?q?=20=20=20the=20pixel=20coordinates=20were=20outside=20this=20bi?= =?UTF-8?q?tmap=20(thanks=20to=20Sascha=20Volkenandt=20for=20=20=20reporti?= =?UTF-8?q?ng=20this=20one).=20-=20The=20cBitmap::DrawText()=20function=20?= =?UTF-8?q?now=20doesn't=20set=20any=20background=20pixels=20if=20the=20?= =?UTF-8?q?=20=20given=20background=20color=20is=20clrTransparent.=20This?= =?UTF-8?q?=20allows=20drawing=20"transparent"=20=20=20texts=20(suggested?= =?UTF-8?q?=20by=20Sascha=20Volkenandt).=20-=20The=20cBitmap::SetXpm()=20f?= =?UTF-8?q?unction=20now=20ignores=20unused=20"none"=20color=20entries,=20?= =?UTF-8?q?which=20=20=20some=20broken=20graphics=20tools=20write=20into?= =?UTF-8?q?=20XPM=20files=20(suggested=20by=20Sascha=20Volkenandt).=20-=20?= =?UTF-8?q?No=20longer=20setting=20lnb=20voltage=20if=20the=20frontend=20i?= =?UTF-8?q?s=20not=20DVB-S=20(thanks=20to=20Marco=20=20=20Schl=C3=BC=C3=9F?= =?UTF-8?q?ler).=20-=20Fixed=20displaying=20the=20current=20channel=20when?= =?UTF-8?q?=20switching=20via=20the=20SVDRP=20command=20CHAN=20=20=20(than?= =?UTF-8?q?ks=20to=20J=C3=BCrgen=20Schmitz=20for=20reporting=20this=20one)?= =?UTF-8?q?.=20-=20Fixed=20missing=20audio=20after=20replaying=20a=20DVD?= =?UTF-8?q?=20(thanks=20to=20Marco=20Schl=C3=BC=C3=9Fler).=20-=20Added=20a?= =?UTF-8?q?=20note=20about=20the=20default=20assignment=20of=20the=20color?= =?UTF-8?q?=20keys=20to=20MANUAL.=20-=20Added=20a=20note=20about=20NPTL=20?= =?UTF-8?q?("Native=20Posix=20Thread=20Library")=20to=20the=20INSTALL=20fi?= =?UTF-8?q?le=20=20=20(apparently=20the=20"fix"=20in=20version=201.3.0=20d?= =?UTF-8?q?idn't=20really=20fix=20this).=20-=20Modified=20'libsi'=20to=20r?= =?UTF-8?q?equire=20callers=20to=20state=20the=20buffer=20sizes=20when=20g?= =?UTF-8?q?etting=20=20=20strings=20in=20order=20to=20avoid=20buffer=20ove?= =?UTF-8?q?rflows=20(thanks=20to=20Philip=20Lawatsch=20for=20=20=20debuggi?= =?UTF-8?q?ng=20a=20buffer=20overflow=20in=20eit.c).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osd.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'osd.c') diff --git a/osd.c b/osd.c index a63d0e1..ac950ff 100644 --- a/osd.c +++ b/osd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 1.48 2004/05/28 15:33:22 kls Exp $ + * $Id: osd.c 1.52 2004/06/05 16:52:51 kls Exp $ */ #include "osd.h" @@ -244,7 +244,7 @@ bool cBitmap::LoadXpm(const char *FileName) return Result; } -bool cBitmap::SetXpm(char *Xpm[]) +bool cBitmap::SetXpm(char *Xpm[], bool IgnoreNone) { char **p = Xpm; int w, h, n, c; @@ -257,10 +257,11 @@ bool cBitmap::SetXpm(char *Xpm[]) return false; } int b = 0; - while (1 << (1 << b) < n) + while (1 << (1 << b) < (IgnoreNone ? n - 1 : n)) b++; SetBpp(1 << b); SetSize(w, h); + int NoneColorIndex = MAXNUMCOLORS; for (int i = 0; i < n; i++) { const char *s = *++p; if (int(strlen(s)) < c) { @@ -273,14 +274,18 @@ bool cBitmap::SetXpm(char *Xpm[]) return false; } s = skipspace(s + 1); - if (strcasecmp(s, "none") == 0) + if (strcasecmp(s, "none") == 0) { s = "#00000000"; + NoneColorIndex = i; + if (IgnoreNone) + continue; + } if (*s != '#') { esyslog("ERROR: unknown color code in XPM: '%c'", *s); return false; } tColor color = strtoul(++s, NULL, 16) | 0xFF000000; - SetColor(i, color); + SetColor((IgnoreNone && i > NoneColorIndex) ? i - 1 : i, color); } for (int y = 0; y < h; y++) { const char *s = *++p; @@ -295,13 +300,17 @@ bool cBitmap::SetXpm(char *Xpm[]) return false; } if (strncmp(Xpm[i + 1], s, c) == 0) { - SetIndex(x, y, i); + if (i == NoneColorIndex) + NoneColorIndex = MAXNUMCOLORS; + SetIndex(x, y, (IgnoreNone && i > NoneColorIndex) ? i - 1 : i); break; } } s += c; } } + if (NoneColorIndex < MAXNUMCOLORS && !IgnoreNone) + return SetXpm(Xpm, true); return true; } @@ -324,7 +333,8 @@ void cBitmap::DrawPixel(int x, int y, tColor Color) { x -= x0; y -= y0; - SetIndex(x, y, Index(Color)); + if (0 <= x && x < width && 0 <= y && y < height) + SetIndex(x, y, Index(Color)); } void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg) @@ -354,7 +364,8 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color int ch = Height ? Height : h; if (!Intersects(x, y, x + cw - 1, y + ch - 1)) return; - DrawRectangle(x, y, x + cw - 1, y + ch - 1, ColorBg); + if (ColorBg != clrTransparent) + DrawRectangle(x, y, x + cw - 1, y + ch - 1, ColorBg); limit = x + cw - x0; if (Width) { if ((Alignment & taLeft) != 0) @@ -386,7 +397,7 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color x -= x0; y -= y0; tIndex fg = Index(ColorFg); - tIndex bg = Index(ColorBg); + tIndex bg = (ColorBg != clrTransparent) ? Index(ColorBg) : 0; while (s && *s) { const cFont::tCharData *CharData = Font->CharData(*s++); if (limit && int(x + CharData->width) > limit) @@ -395,7 +406,8 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color for (int row = 0; row < h; row++) { cFont::tPixelData PixelData = CharData->lines[row]; for (int col = CharData->width; col-- > 0; ) { - SetIndex(x + col, y + row, (PixelData & 1) ? fg : bg); + if (ColorBg != clrTransparent || (PixelData & 1)) + SetIndex(x + col, y + row, (PixelData & 1) ? fg : bg); PixelData >>= 1; } } -- cgit v1.2.3