summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-07-08 17:41:06 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-07-08 17:41:06 +0100
commite9401de768fa2a3c37bc3f13a06bb3bc32c8dc4c (patch)
tree047d036fb96883f0c237b698b520b2ad6169cf91
parent81a1506c5c3a5b1581c3f16350a64ce58e695c09 (diff)
downloadnetsurf-e9401de768fa2a3c37bc3f13a06bb3bc32c8dc4c.tar.gz
netsurf-e9401de768fa2a3c37bc3f13a06bb3bc32c8dc4c.tar.bz2
Move mix_colour macro out of treeview for other stuff to use.
-rw-r--r--desktop/plot_style.h8
-rw-r--r--desktop/treeview.c13
2 files changed, 8 insertions, 13 deletions
diff --git a/desktop/plot_style.h b/desktop/plot_style.h
index f965a2578..71243a9a9 100644
--- a/desktop/plot_style.h
+++ b/desktop/plot_style.h
@@ -66,6 +66,14 @@
(((c0 & 0xff0000) * 28) >> 24)) > \
(0xff / 2)) ? 0x000000 : 0xffffff)
+/* Mix two colours according to the proportion given by p, where 0 <= p <= 255
+ * p = 0 gives result ==> c1, p = 255 gives result ==> c0 */
+#define mix_colour(c0, c1, p) \
+ ((((((c1 & 0xff00ff) * (255 - p)) + \
+ ((c0 & 0xff00ff) * ( p)) ) >> 8) & 0xff00ff) | \
+ (((((c1 & 0x00ff00) * (255 - p)) + \
+ ((c0 & 0x00ff00) * ( p)) ) >> 8) & 0x00ff00))
+
/* get a bitmap pixel (image/bitmap.h) into a plot colour */
#define pixel_to_colour(b) \
b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 3895832b2..1e3ea1e2a 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -1903,19 +1903,6 @@ void treeview_mouse_action(treeview *tree,
}
-
-/* Mix two colours according to the proportion given by p.
- * Where 0 <= p <= 255
- * p=0 gives result ==> c1
- * p=255 gives result ==> c0
- */
-#define mix_colour(c0, c1, p) \
- ((((((c1 & 0xff00ff) * (255 - p)) + \
- ((c0 & 0xff00ff) * ( p)) ) >> 8) & 0xff00ff) | \
- (((((c1 & 0x00ff00) * (255 - p)) + \
- ((c0 & 0x00ff00) * ( p)) ) >> 8) & 0x00ff00))
-
-
/**
* Initialise the plot styles from CSS system colour values.
*/