summaryrefslogtreecommitdiff
path: root/dxr3osd.c
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-09 09:22:06 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-09 09:22:06 +0200
commitf908595e7f38e09d8b7073ee62e2873f7eb8bc5d (patch)
tree2111d919d661f49ea42f8d5e31ea259a264635a6 /dxr3osd.c
parent92173126abead8179491eb06d886e6e0ce8bc93a (diff)
downloadvdr-plugin-dxr3-f908595e7f38e09d8b7073ee62e2873f7eb8bc5d.tar.gz
vdr-plugin-dxr3-f908595e7f38e09d8b7073ee62e2873f7eb8bc5d.tar.bz2
determine the palette used by all bitmaps
Diffstat (limited to 'dxr3osd.c')
-rw-r--r--dxr3osd.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/dxr3osd.c b/dxr3osd.c
index f9bed42..4ebebde 100644
--- a/dxr3osd.c
+++ b/dxr3osd.c
@@ -156,6 +156,9 @@ eOsdError cDxr3Osd::SetAreas(const tArea *Areas, int NumAreas)
delete mergedBitmap;
mergedBitmap = new cBitmap(w, h, 4, 0, 0);
+
+ // reset current used merged palette
+ Palette->Reset();
}
return cOsd::SetAreas(Areas, NumAreas);
@@ -180,7 +183,39 @@ void cDxr3Osd::Flush()
} else {
- /* TODO */
+ typedef std::pair<tIndex, tIndex> transPair;
+
+ // determine the palette used by all bitmaps
+ bool success = true;
+
+ for (int i = 0; i < numAreas; i++) {
+
+ cBitmap *tmp = GetBitmap(i);
+ int numColors;
+ const tColor *color = tmp->Colors(numColors);
+ transPair pair[16];
+ int numPair = 0;
+
+ for (int c = 0; c < numColors; c++) {
+ int idx = Palette->Index(color[c]);
+
+ if (idx == -1) {
+ success = false;
+ break;
+ }
+
+ dsyslog("%d) old %d new %d", i, c, idx);
+
+ if (c != idx) {
+ pair[numPair] = transPair(c, idx);
+ numPair++;
+ }
+ }
+
+ if (!success) {
+ esyslog("[dxr3-osd] too many colors used by OSD");
+ }
+ }
}
if (!bmap)