summaryrefslogtreecommitdiff
path: root/dxr3osd.c
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-09 09:34:24 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-09 09:34:24 +0200
commit84b7735d1a1dbbdf156bc6fd03416fd56168d561 (patch)
tree3e1ec3ebcf4d7e7c96a4e071a56d7d18f7e4ec9a /dxr3osd.c
parentf908595e7f38e09d8b7073ee62e2873f7eb8bc5d (diff)
downloadvdr-plugin-dxr3-84b7735d1a1dbbdf156bc6fd03416fd56168d561.tar.gz
vdr-plugin-dxr3-84b7735d1a1dbbdf156bc6fd03416fd56168d561.tar.bz2
copy area bitmaps to mergedBitmap with needed transforming of indexes
Diffstat (limited to 'dxr3osd.c')
-rw-r--r--dxr3osd.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/dxr3osd.c b/dxr3osd.c
index 4ebebde..3c98229 100644
--- a/dxr3osd.c
+++ b/dxr3osd.c
@@ -183,8 +183,6 @@ void cDxr3Osd::Flush()
} else {
- typedef std::pair<tIndex, tIndex> transPair;
-
// determine the palette used by all bitmaps
bool success = true;
@@ -215,6 +213,15 @@ void cDxr3Osd::Flush()
if (!success) {
esyslog("[dxr3-osd] too many colors used by OSD");
}
+
+ // if part is not dirty, we can continue to the next area
+ if (!tmp->Dirty(x1, y1, x2, y2)) {
+ continue;
+ }
+
+ // copy data into mergedBitmap and mark part as clean
+ copy(tmp, i, pair, numPair);
+ tmp->Clean();
}
}
@@ -387,6 +394,44 @@ void cDxr3Osd::Flush()
#endif
}
+void cDxr3Osd::copy(cBitmap *part, int area, transPair pair[16], int numPair)
+{
+ tArea usedArea = areas[area];
+
+ // a small optimization
+ if (numPair == 0) {
+
+ // we do not need to transform anything, just do a copy
+
+ for (int x = 0; x < part->Width(); x++) {
+ for (int y = 0; y < part->Height(); y++) {
+
+ tIndex val = *part->Data(x, y);
+ mergedBitmap->SetIndex(x + usedArea.x1, y + usedArea.y1, val);
+ }
+ }
+
+ } else {
+
+ // we need to transform and to do a copy
+
+ for (int x = 0; x < part->Width(); x++) {
+ for (int y = 0; y < part->Height(); y++) {
+
+ tIndex val = *part->Data(x, y);
+
+ for (int t = 0; t < numPair; t++) {
+ if (val == pair[t].first) {
+ val = pair[t].second;
+ break;
+ }
+ }
+
+ mergedBitmap->SetIndex(x + usedArea.x1, y + usedArea.y1, val);
+ }
+ }
+ }
+}
// Local variables:
// mode: c++