1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

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

This commit is contained in:
Klaus Schmidinger 2010-01-22 15:58:39 +01:00
parent 27aaf4fc06
commit eb394c68f1

4
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osd.c 2.8 2010/01/17 13:43:02 kls Exp $ * $Id: osd.c 2.9 2010/01/22 15:58:39 kls Exp $
*/ */
#include "osd.h" #include "osd.h"
@ -151,7 +151,7 @@ int cPalette::ClosestColor(tColor Color, int MaxDiff) const
int G2 = (color[i] & 0x0000FF00) >> 8; int G2 = (color[i] & 0x0000FF00) >> 8;
int B2 = (color[i] & 0x000000FF); int B2 = (color[i] & 0x000000FF);
int diff = 0; int diff = 0;
if (A1 && A2) // fully transparent colors are considered equal 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); diff = (abs(A1 - A2) << 1) + (abs(R1 - R2) << 1) + (abs(G1 - G2) << 1) + (abs(B1 - B2) << 1);
if (diff < d) { if (diff < d) {
d = diff; d = diff;