cPalette::ClosestColor() now treats fully transparent colors as "equal"; improved cDvbSpuBitmap::getMinBpp()

This commit is contained in:
Klaus Schmidinger 2010-01-17 13:48:44 +01:00
parent 27939266f1
commit 40bb2f21e0
4 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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).

View File

@ -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)

8
osd.c
View File

@ -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;