summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-01-17 13:48:44 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2010-01-17 13:48:44 +0100
commit40bb2f21e08b8c5c4b9e5afde110825c7e3a354b (patch)
tree6a66c7720138baa8853ca03fda54f450c11616f8
parent27939266f19e16676ab1c80a5a4ecad72e852f12 (diff)
downloadvdr-40bb2f21e08b8c5c4b9e5afde110825c7e3a354b.tar.gz
vdr-40bb2f21e08b8c5c4b9e5afde110825c7e3a354b.tar.bz2
cPalette::ClosestColor() now treats fully transparent colors as "equal"; improved cDvbSpuBitmap::getMinBpp()
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--dvbspu.c4
-rw-r--r--osd.c8
4 files changed, 11 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index f921d575..7d76e2e4 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2497,6 +2497,7 @@ Johann Friedrichs <johann.friedrichs@web.de>
for removing the workaround for short channel names of "Kabel Deutschland"
for some fixes to dvbspu.[hc]
for fixing a busy loop when moving editing marks
+ for making cPalette::ClosestColor() treat fully transparent colors as "equal"
Timo Helkio <timolavi@mbnet.fi>
for reporting a hangup when replaying a TS recording with subtitles activated
@@ -2544,6 +2545,7 @@ Andreas Schaefers <andreas_schaefers@gmx.de>
Matthieu Castet <castet.matthieu@free.fr>
for improving SPU handling on devices with limited OSD capabilities
+ for making cPalette::ClosestColor() treat fully transparent colors as "equal"
Francesco Saverio Schiavarelli <fschiava@libero.it>
for reporting a problem with channels that have some encrypted components that
diff --git a/HISTORY b/HISTORY
index 89060194..a29ba7f8 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6289,3 +6289,5 @@ Video Disk Recorder Revision History
in 'make install' (thanks to Martin Dauskardt).
- Added plain text error messages to log entries from cOsd::SetAreas() (suggested
by Rolf Ahrenberg).
+- cPalette::ClosestColor() now treats fully transparent colors as "equal"; improved
+ cDvbSpuBitmap::getMinBpp() (thanks to Matthieu Castet and Johann Friedrichs).
diff --git a/dvbspu.c b/dvbspu.c
index 488bd89f..951e2f8c 100644
--- a/dvbspu.c
+++ b/dvbspu.c
@@ -8,7 +8,7 @@
*
* parts of this file are derived from the OMS program.
*
- * $Id: dvbspu.c 2.7 2009/12/26 15:51:15 kls Exp $
+ * $Id: dvbspu.c 2.8 2010/01/17 13:43:27 kls Exp $
*/
#include "dvbspu.h"
@@ -347,7 +347,7 @@ int cDvbSpuBitmap::getMinBpp(const aDvbSpuPalDescr paldescr)
col++;
}
}
- return col > 2 ? 4 : 2;
+ return col > 2 ? 2 : 1;
}
int cDvbSpuDecoder::CalcAreaBpp(cBitmap *fgbmp, cBitmap *bgbmp)
diff --git a/osd.c b/osd.c
index 80cbbaa2..0bc80d37 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 2.7 2010/01/17 13:27:24 kls Exp $
+ * $Id: osd.c 2.8 2010/01/17 13:43:02 kls Exp $
*/
#include "osd.h"
@@ -145,12 +145,14 @@ int cPalette::ClosestColor(tColor Color, int MaxDiff) const
int R1 = (Color & 0x00FF0000) >> 16;
int G1 = (Color & 0x0000FF00) >> 8;
int B1 = (Color & 0x000000FF);
- for (int i = 0; i < numColors; i++) {
+ for (int i = 0; i < numColors && d > 0; i++) {
int A2 = (color[i] & 0xFF000000) >> 24;
int R2 = (color[i] & 0x00FF0000) >> 16;
int G2 = (color[i] & 0x0000FF00) >> 8;
int B2 = (color[i] & 0x000000FF);
- int diff = (abs(A1 - A2) << 1) + (abs(R1 - R2) << 1) + (abs(G1 - G2) << 1) + (abs(B1 - B2) << 1);
+ int diff = 0;
+ if (A1 && A2) // fully transparent colors are considered equal
+ diff = (abs(A1 - A2) << 1) + (abs(R1 - R2) << 1) + (abs(G1 - G2) << 1) + (abs(B1 - B2) << 1);
if (diff < d) {
d = diff;
n = i;