summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--screen.c24
-rw-r--r--screen.h9
2 files changed, 29 insertions, 4 deletions
diff --git a/screen.c b/screen.c
index a4434ee..757bd5a 100644
--- a/screen.c
+++ b/screen.c
@@ -1,5 +1,5 @@
/*
- * $Id: screen.c,v 1.1 2004/12/19 22:03:18 lordjaxom Exp $
+ * $Id: screen.c,v 1.2 2005/01/25 20:27:12 lordjaxom Exp $
*/
#include "screen.h"
@@ -59,7 +59,8 @@ void cText2SkinScreen::Clear(void) {
void cText2SkinScreen::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg) {
#ifndef DIRECTBLIT
for (int i = 0; i < mNumRegions; ++i)
- mRegions[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg);
+ DrawBitmapOverlay(*mRegions[i], x, y, (cBitmap&)Bitmap, ColorFg, ColorBg);
+ //mRegions[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg);
#else
mOsd->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg);
#endif
@@ -114,3 +115,22 @@ void cText2SkinScreen::Flush(void) {
mOsd->Flush();
}
+void cText2SkinScreen::DrawBitmapOverlay(cBitmap &Dest, int x, int y, cBitmap &Bitmap, tColor ColorFg,
+ tColor ColorBg, tColor *ColorMask)
+{
+ const tIndex *bitmap = Dest.Data(0, 0);
+ if (bitmap && Bitmap.Data(0, 0) && Dest.Intersects(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) {
+ if (Dest.Covers(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1))
+ Dest.Reset();
+ x -= Dest.X0();
+ y -= Dest.Y0();
+ tIndex Indexes[MAXNUMCOLORS];
+ Dest.Take(Bitmap, &Indexes, ColorFg, ColorBg);
+ for (int ix = 0; ix < Bitmap.Width(); ix++) {
+ for (int iy = 0; iy < Bitmap.Height(); iy++) {
+ if (ColorMask == NULL || *ColorMask != *Bitmap.Data(ix, iy))
+ Dest.SetIndex(x + ix, y + iy, Indexes[int(*Bitmap.Data(ix, iy))]);
+ }
+ }
+ }
+}
diff --git a/screen.h b/screen.h
index d57ce9b..c4d11ba 100644
--- a/screen.h
+++ b/screen.h
@@ -1,5 +1,5 @@
/*
- * $Id: screen.h,v 1.1 2004/12/19 22:03:18 lordjaxom Exp $
+ * $Id: screen.h,v 1.2 2005/01/25 20:27:12 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_SCREEN_H
@@ -21,6 +21,10 @@ private:
bool mOffScreen;
int mNumRegions;
+protected:
+ static void DrawBitmapOverlay(cBitmap &Dest, int x, int y, cBitmap &Bitmap, tColor ColorFg = 0,
+ tColor ColorBg = 0, tColor *ColorMask = NULL);
+
public:
cText2SkinScreen(bool OffScreen = false);
~cText2SkinScreen();
@@ -30,7 +34,8 @@ public:
void Clear(void);
void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0);
void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
- void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault);
+ void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font,
+ int Width = 0, int Height = 0, int Alignment = taDefault);
void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);
void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type);