Fixed handling bitmap indexes for 256 color mode

This commit is contained in:
Klaus Schmidinger 2004-01-31 10:34:05 +01:00
parent f48061576e
commit a09f209122
4 changed files with 18 additions and 14 deletions

View File

@ -925,3 +925,6 @@ Christian Tramnitz <maillist@tramnitz.com>
Jens Rosenboom <me@jayr.de> Jens Rosenboom <me@jayr.de>
for fixing the SVDRP command 'STAT DISK' to avoid a 'division by 0' in case for fixing the SVDRP command 'STAT DISK' to avoid a 'division by 0' in case
the disk is full the disk is full
Andreas Regel <andreas.regel@gmx.de>
for fixing handling bitmap indexes for 256 color mode

View File

@ -2633,3 +2633,4 @@ Video Disk Recorder Revision History
- Fixed handling CA ids (was broken in 1.3.4). - Fixed handling CA ids (was broken in 1.3.4).
- Fixed the SVDRP command 'STAT DISK' to avoid a 'division by 0' in case the - Fixed the SVDRP command 'STAT DISK' to avoid a 'division by 0' in case the
disk is full (thanks to Jens Rosenboom). disk is full (thanks to Jens Rosenboom).
- Fixed handling bitmap indexes for 256 color mode (thanks to Andreas Regel).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.c 1.11 2003/10/19 14:32:32 kls Exp $ * $Id: osdbase.c 1.12 2004/01/31 10:31:13 kls Exp $
*/ */
#include "osdbase.h" #include "osdbase.h"
@ -116,7 +116,7 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
fontType = fontOsd; fontType = fontOsd;
font = NULL; font = NULL;
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
bitmap = MALLOC(char, width * height); bitmap = MALLOC(u_char, width * height);
if (bitmap) { if (bitmap) {
Clean(); Clean();
memset(bitmap, 0x00, width * height); memset(bitmap, 0x00, width * height);
@ -186,7 +186,7 @@ void cBitmap::Clean(void)
dirtyY2 = -1; dirtyY2 = -1;
} }
void cBitmap::SetIndex(int x, int y, char Index) void cBitmap::SetIndex(int x, int y, u_char Index)
{ {
if (bitmap) { if (bitmap) {
if (0 <= x && x < width && 0 <= y && y < height) { if (0 <= x && x < width && 0 <= y && y < height) {
@ -231,8 +231,8 @@ int cBitmap::Width(const char *s)
void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg) void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
{ {
if (bitmap) { if (bitmap) {
char fg = Index(ColorFg); u_char fg = Index(ColorFg);
char bg = Index(ColorBg); u_char bg = Index(ColorBg);
int h = font->Height(s); int h = font->Height(s);
while (s && *s) { while (s && *s) {
const cFont::tCharData *CharData = font->CharData(*s++); const cFont::tCharData *CharData = font->CharData(*s++);
@ -253,7 +253,7 @@ void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor Col
void cBitmap::Fill(int x1, int y1, int x2, int y2, eDvbColor Color) void cBitmap::Fill(int x1, int y1, int x2, int y2, eDvbColor Color)
{ {
if (bitmap) { if (bitmap) {
char c = Index(Color); u_char c = Index(Color);
for (int y = y1; y <= y2; y++) for (int y = y1; y <= y2; y++)
for (int x = x1; x <= x2; x++) for (int x = x1; x <= x2; x++)
SetIndex(x, y, c); SetIndex(x, y, c);
@ -267,7 +267,7 @@ void cBitmap::Clear(void)
Fill(0, 0, width - 1, height - 1, clrBackground); Fill(0, 0, width - 1, height - 1, clrBackground);
} }
const char *cBitmap::Data(int x, int y) const u_char *cBitmap::Data(int x, int y)
{ {
return &bitmap[y * width + x]; return &bitmap[y * width + x];
} }
@ -327,7 +327,7 @@ void cWindow::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor Col
cBitmap::Text(x, y, s, ColorFg, ColorBg); cBitmap::Text(x, y, s, ColorFg, ColorBg);
} }
const char *cWindow::Data(int x, int y) const u_char *cWindow::Data(int x, int y)
{ {
return cBitmap::Data(x, y); return cBitmap::Data(x, y);
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.h 1.8 2004/01/04 15:19:20 kls Exp $ * $Id: osdbase.h 1.9 2004/01/31 10:28:49 kls Exp $
*/ */
#ifndef __OSDBASE_H #ifndef __OSDBASE_H
@ -49,7 +49,7 @@ private:
bool fetched[MAXNUMCOLORS]; bool fetched[MAXNUMCOLORS];
bool full; bool full;
protected: protected:
typedef unsigned char tIndexes[MAXNUMCOLORS]; typedef u_char tIndexes[MAXNUMCOLORS];
public: public:
cPalette(int Bpp); cPalette(int Bpp);
int Index(eDvbColor Color); int Index(eDvbColor Color);
@ -75,7 +75,7 @@ class cBitmap : public cPalette {
private: private:
const cFont *font; const cFont *font;
eDvbFont fontType; eDvbFont fontType;
char *bitmap; u_char *bitmap;
bool clearWithBackground; bool clearWithBackground;
protected: protected:
int width, height; int width, height;
@ -86,7 +86,7 @@ public:
bool ClearWithBackground(void) { return clearWithBackground; } bool ClearWithBackground(void) { return clearWithBackground; }
eDvbFont SetFont(eDvbFont Font); eDvbFont SetFont(eDvbFont Font);
bool Dirty(int &x1, int &y1, int &x2, int &y2); bool Dirty(int &x1, int &y1, int &x2, int &y2);
void SetIndex(int x, int y, char Index); void SetIndex(int x, int y, u_char Index);
void SetPixel(int x, int y, eDvbColor Color); void SetPixel(int x, int y, eDvbColor Color);
void SetBitmap(int x, int y, const cBitmap &Bitmap); void SetBitmap(int x, int y, const cBitmap &Bitmap);
int Width(void) { return width; } int Width(void) { return width; }
@ -97,7 +97,7 @@ public:
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); void Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
void Clean(void); void Clean(void);
void Clear(void); void Clear(void);
const char *Data(int x, int y); const u_char *Data(int x, int y);
}; };
#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
@ -122,7 +122,7 @@ public:
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); void Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
void SetBitmap(int x, int y, const cBitmap &Bitmap); void SetBitmap(int x, int y, const cBitmap &Bitmap);
void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground);
const char *Data(int x, int y); const u_char *Data(int x, int y);
}; };
typedef int tWindowHandle; typedef int tWindowHandle;