10 #include <linux/dvb/osd.h>
11 #include <sys/ioctl.h>
16 #define MAX_NUM_FONTFACES 8
17 #define MAX_NUM_FONTS 8
18 #define MAX_BITMAP_SIZE (1024*1024)
59 virtual void SaveRegion(
int x1,
int y1,
int x2,
int y2);
62 virtual void DrawBitmap(
int x,
int y,
const cBitmap &Bitmap,
tColor ColorFg = 0,
tColor ColorBg = 0,
bool ReplacePalette =
false,
bool Overlay =
false);
65 virtual void DrawEllipse(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Quadrants = 0);
66 virtual void DrawSlope(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Type);
67 virtual void Flush(
void);
71 :
cOsd(Left, Top, Level)
88 memset(&config, 0,
sizeof(config));
139 for (
int i = 0; i < NumAreas; i++)
141 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
153 for (
int i = 0; i < NumAreas; i++)
165 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
216 for (i = 0; i < numColors; i++)
219 if (ColorFg || ColorBg)
242 for (
int yc = 0; yc <
height; yc += chunk)
245 if (yc + hc > height)
248 (uint8_t *) Bitmap.
Data(0, yc),
width, hc,
256 int w = Font->
Width(s);
259 int cw = Width ? Width : w;
260 int ch = Height ? Height : h;
262 int size = Font->
Size();
284 if (pFontFace == NULL)
286 if (i < MAX_NUM_FONTFACES)
289 FILE * fp = fopen(fontFileName,
"rb");
292 fseek(fp, 0, SEEK_END);
293 long fileSize = ftell(fp);
294 fseek(fp, 0, SEEK_SET);
297 uint8_t * buffer =
new uint8_t[fileSize];
300 if (fread(buffer, fileSize, 1, fp) == 1)
316 if (pFontFace == NULL)
334 if (i < MAX_NUM_FONTS)
355 if ((Alignment &
taLeft) != 0)
357 #if (APIVERSNUM >= 10728)
362 else if ((Alignment &
taRight) != 0)
366 #if (APIVERSNUM >= 10728)
374 x += (Width - w) / 2;
379 if ((Alignment &
taTop) != 0)
381 else if ((Alignment &
taBottom) != 0)
389 y += (Height - h) / 2;
401 while (*s && (len < (
sizeof(tmp) - 1)))
430 switch (abs(Quadrants))
526 for (
int i = 0; (Bitmap =
GetBitmap(i)) != NULL; i++)
533 if (Bitmap->
Dirty(x1, y1, x2, y2))
569 virtual void Flush(
void);
573 :
cOsd(Left, Top, Level)
641 for (
int i = 0; i < NumAreas; i++)
643 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8
653 for (
int i = 0; i < NumAreas; i++)
681 int w = pm->ViewPort().Width();
682 int h = pm->ViewPort().Height();
683 int d = w *
sizeof(
tColor);
687 for (
int y = 0; y < h; y += Chunk)
693 Left() + pm->ViewPort().X(),
Top() + pm->ViewPort().Y() + y,
694 pm->Data() + y * d, w, hc, hc * d,
707 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
709 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
714 x2 = bitmap->
Width() - 1;
715 y2 = bitmap->
Height() - 1;
722 for (
int c = 0; c < numColors; c++)
736 int width = x2 - x1 + 1;
741 for (
int y = 0; y <
height; y += chunk)
746 for (
int r = 0; r < hc; r++)
747 memcpy(buffer + r * width, bitmap->
Data(x1, y1 + y + r),
width);
749 Left() + bitmap->
X0() + x1,
Top() + bitmap->
Y0() + y1 + y,