r13742 tlsa - /trunk/netsurf/desktop/plot_style.h

netsurf at semichrome.net netsurf at semichrome.net
Tue Mar 27 12:55:57 BST 2012


Author: tlsa
Date: Tue Mar 27 06:55:57 2012
New Revision: 13742

URL: http://source.netsurf-browser.org?rev=13742&view=rev
Log:
Fix lighten_colour and double_lighten_colour to prevent alpha bleeding into red channel.  Make macros clearer.

Modified:
    trunk/netsurf/desktop/plot_style.h

Modified: trunk/netsurf/desktop/plot_style.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/plot_style.h?rev=13742&r1=13741&r2=13742&view=diff
==============================================================================
--- trunk/netsurf/desktop/plot_style.h (original)
+++ trunk/netsurf/desktop/plot_style.h Tue Mar 27 06:55:57 2012
@@ -32,29 +32,29 @@
 /* Darken a colour by taking three quarters of each channel's intensity */
 #define darken_colour(c1)				 		\
 	((((3 * ((c1 >> 16) & 0xff)) >> 2) << 16) |			\
-	 (((3 * ((c1 >> 8) & 0xff)) >> 2) << 8) |	 		\
-	 (((3 * (c1 & 0xff)) >> 2) << 0))
+	 (((3 * ((c1 >>  8) & 0xff)) >> 2) <<  8) |	 		\
+	 (((3 * ( c1        & 0xff)) >> 2) <<  0))
 
 /* Darken a colour by taking nine sixteenths of each channel's intensity */
 #define double_darken_colour(c1)			 		\
 	((((9 * ((c1 >> 16) & 0xff)) >> 4) << 16) |			\
-	 (((9 * ((c1 >> 8) & 0xff)) >> 4) << 8) |	 		\
-	 (((9 * (c1 & 0xff)) >> 4) << 0))
+	 (((9 * ((c1 >>  8) & 0xff)) >> 4) <<  8) |	 		\
+	 (((9 * ( c1        & 0xff)) >> 4) <<  0))
 
 /* Lighten a colour by taking three quarters of each channel's intensity
  * and adding a full quarter
  */
 #define lighten_colour(c1)						\
-	(((((3 * (c1 >> 16)) >> 2) + 64) << 16) |			\
-	 ((((3 * ((c1 >> 8) & 0xff)) >> 2) + 64) << 8) |		\
-	 ((((3 * (c1 & 0xff)) >> 2) + 64) << 0))
+	(((((3 * ((c1 >> 16) & 0xff)) >> 2) + 64) << 16) |		\
+	 ((((3 * ((c1 >>  8) & 0xff)) >> 2) + 64) <<  8) |		\
+	 ((((3 * ( c1        & 0xff)) >> 2) + 64) <<  0))
 
 /* Lighten a colour by taking nine sixteenths of each channel's intensity and
  * adding a full intensity 7/16ths */
 #define double_lighten_colour(c1)					\
-	(((((9 * (c1 >> 16)) >> 4) + 112) << 16) |			\
-	 ((((9 * ((c1 >> 8) & 0xff)) >> 4) + 112) << 8) |		\
-	 ((((9 * (c1 & 0xff)) >> 4) + 112) << 0))
+	(((((9 * ((c1 >> 16) & 0xff)) >> 4) + 112) << 16) |		\
+	 ((((9 * ((c1 >>  8) & 0xff)) >> 4) + 112) <<  8) |		\
+	 ((((9 * ( c1        & 0xff)) >> 4) + 112) <<  0))
 
 /* Blend two colours by taking half the intensity of each channel in the first
  * colour and adding them to half the intensity of each channel in the second




More information about the netsurf-commits mailing list