vdr-1.6 merge transparent color

Message ID 4B084F86.8090703@free.fr
State New
Headers

Commit Message

matthieu castet Nov. 21, 2009, 8:37 p.m. UTC
  Hi,

this patch merge all color that are transparent (alpha = 0) in ClosestColor.
This allow to save precious color Index on ff cards.

Matthieu
  

Comments

Klaus Schmidinger Dec. 5, 2009, 2:52 p.m. UTC | #1
On 21.11.2009 21:37, matthieu castet wrote:
> Hi,
> 
> this patch merge all color that are transparent (alpha = 0) in
> ClosestColor.
> This allow to save precious color Index on ff cards.

Please provide the patch in a way that works with VDR 1.7.10.

Actually I doubt that this would even work with VDR 1.6.0,
because in cPalette::ClosestColor() 'diff' is only defined
a few lines below the place where your patch attempts to use it.
Have you actually been able to compile this?

Klaus
  

Patch

--- vdr-1.6.0/osd.c	2007-10-12 14:38:36.000000000 +0200
+++ vdr-1.6.0p/osd.c	2009-11-21 21:33:09.000000000 +0100
@@ -141,6 +141,8 @@ 
   int B1 = (Color & 0x000000FF);
   for (int i = 0; i < numColors; i++) {
       int A2 = (color[i] & 0xFF000000) >> 24;
+      if (A2 == 0 && A1 == 0)
+          diff = 0;
       int R2 = (color[i] & 0x00FF0000) >> 16;
       int G2 = (color[i] & 0x0000FF00) >>  8;
       int B2 = (color[i] & 0x000000FF);
@@ -149,6 +151,8 @@ 
          d = diff;
          n = i;
          }
+      if (d == 0)
+          break;
       }
   return d <= MaxDiff ? n : -1;
 }