Fix lighten_colour and double_lighten_colour to prevent alpha bleeding into red channel. Make macros clearer.

svn path=/trunk/netsurf/; revision=13742
This commit is contained in:
Michael Drake 2012-03-27 11:55:57 +00:00
parent fba2ebeee6
commit fc8cf634d5
1 changed files with 10 additions and 10 deletions

View File

@ -45,14 +45,14 @@
* and adding a full quarter
*/
#define lighten_colour(c1) \
(((((3 * (c1 >> 16)) >> 2) + 64) << 16) | \
(((((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 >> 16) & 0xff)) >> 4) + 112) << 16) | \
((((9 * ((c1 >> 8) & 0xff)) >> 4) + 112) << 8) | \
((((9 * ( c1 & 0xff)) >> 4) + 112) << 0))