diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-03-27 11:55:57 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-03-27 11:55:57 +0000 |
commit | fc8cf634d5e5dac20bc28460ee133446d6771df0 (patch) | |
tree | b2b9d925257c8bdf358ddf5ae51bb67aa6b69fae /desktop/plot_style.h | |
parent | fba2ebeee60df8bf10da1186021d0682cc38cb33 (diff) | |
download | netsurf-fc8cf634d5e5dac20bc28460ee133446d6771df0.tar.gz netsurf-fc8cf634d5e5dac20bc28460ee133446d6771df0.tar.bz2 |
Fix lighten_colour and double_lighten_colour to prevent alpha bleeding into red channel. Make macros clearer.
svn path=/trunk/netsurf/; revision=13742
Diffstat (limited to 'desktop/plot_style.h')
-rw-r--r-- | desktop/plot_style.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/desktop/plot_style.h b/desktop/plot_style.h index 057e40fa6..db3f69eb9 100644 --- a/desktop/plot_style.h +++ b/desktop/plot_style.h @@ -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 |