diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-10-09 09:22:06 +0200 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-10-09 09:22:06 +0200 |
commit | f908595e7f38e09d8b7073ee62e2873f7eb8bc5d (patch) | |
tree | 2111d919d661f49ea42f8d5e31ea259a264635a6 /dxr3osd.c | |
parent | 92173126abead8179491eb06d886e6e0ce8bc93a (diff) | |
download | vdr-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.c | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -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) |