8 #include <linux/dvb/osd.h>
14 #define MAX_NUM_FONTFACES 8
15 #define MAX_NUM_FONTS 8
16 #define MAX_BITMAP_SIZE (1024*1024)
56 virtual void SaveRegion(
int x1,
int y1,
int x2,
int y2);
59 virtual void DrawBitmap(
int x,
int y,
const cBitmap &Bitmap,
tColor ColorFg = 0,
tColor ColorBg = 0,
bool ReplacePalette =
false,
bool Overlay =
false);
62 virtual void DrawEllipse(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Quadrants = 0);
63 virtual void DrawSlope(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Type);
64 virtual void Flush(
void);
68 :
cOsd(Left, Top, Level)
84 memset(&config, 0,
sizeof(config));
137 for (
int i = 0; i < NumAreas; i++)
139 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
151 for (
int i = 0; i < NumAreas; i++)
162 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
212 for (i = 0; i < numColors; i++)
215 if (ColorFg || ColorBg)
238 for (
int yc = 0; yc <
height; yc += chunk)
241 if (yc + hc > height)
244 (uint8_t *) Bitmap.
Data(0, yc),
width, hc,
252 int w = Font->
Width(s);
254 int cw = Width ? Width : w;
255 int ch = Height ? Height : h;
257 int size = Font->
Size();
279 if (pFontFace == NULL)
281 if (i < MAX_NUM_FONTFACES)
284 FILE * fp = fopen(fontFileName,
"rb");
287 fseek(fp, 0, SEEK_END);
288 long fileSize = ftell(fp);
289 fseek(fp, 0, SEEK_SET);
292 uint8_t * buffer =
new uint8_t[fileSize];
295 if (fread(buffer, fileSize, 1, fp) == 1)
311 if (pFontFace == NULL)
329 if (i < MAX_NUM_FONTS)
349 if ((Alignment &
taLeft) != 0)
351 #if (APIVERSNUM >= 10728)
356 else if ((Alignment &
taRight) != 0)
360 #if (APIVERSNUM >= 10728)
368 x += (Width - w) / 2;
373 if ((Alignment &
taTop) != 0)
375 else if ((Alignment &
taBottom) != 0)
383 y += (Height - h) / 2;
397 while (*s && (len < (
sizeof(tmp) - 1)))
426 switch (abs(Quadrants))
512 x2 - x1 + 1, y2 - y1 + 1, Color, Type);
524 for (
int i = 0; (Bitmap =
GetBitmap(i)) != NULL; i++)
531 if (Bitmap->
Dirty(x1, y1, x2, y2))
567 virtual void Flush(
void);
571 :
cOsd(Left, Top, Level)
639 for (
int i = 0; i < NumAreas; i++)
641 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8
651 for (
int i = 0; i < NumAreas; i++)
679 int w = pm->ViewPort().Width();
680 int h = pm->ViewPort().Height();
681 int d = w *
sizeof(
tColor);
685 for (
int y = 0; y < h; y += Chunk)
691 Left() + pm->ViewPort().X(),
Top() + pm->ViewPort().Y() + y,
692 pm->Data() + y * d, w, hc, hc * d,
705 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
707 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
712 x2 = bitmap->
Width() - 1;
713 y2 = bitmap->
Height() - 1;
720 for (
int c = 0; c < numColors; c++)
734 int width = x2 - x1 + 1;
739 for (
int y = 0; y <
height; y += chunk)
744 for (
int r = 0; r < hc; r++)
745 memcpy(buffer + r * width, bitmap->
Data(x1, y1 + y + r),
width);
747 Left() + bitmap->
X0() + x1,
Top() + bitmap->
Y0() + y1 + y,