Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/ec3491280a67ea55d322b...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/ec3491280a67ea55d322baf...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/ec3491280a67ea55d322baf73...
The branch, master has been updated
via ec3491280a67ea55d322baf736d538815a4a6087 (commit)
from 92d6c14c8dfd7b4978deca602d51d3afbbfdcfe7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=ec3491280a67ea55d32...
commit ec3491280a67ea55d322baf736d538815a4a6087
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move NetSurf to CSS colour conversion macro. Make both conversion macros the same.
diff --git a/css/utils.h b/css/utils.h
index 9d40aba..f3131f1 100644
--- a/css/utils.h
+++ b/css/utils.h
@@ -27,17 +27,32 @@ extern css_fixed nscss_screen_dpi;
/**
* Convert a CSS color to a NetSurf colour primitive
- *
+ *
* ARGB -> (1-A)BGR
*
* \param color The CSS color to convert
* \return Corresponding NetSurf colour primitive
*/
-#define nscss_color_to_ns(color) \
- (0xff000000 - ((color) & 0xff000000)) | \
- (((color) & 0xff0000) >> 16) | \
- ((color) & 0xff00) | \
- (((color) & 0xff) << 16)
+#define nscss_color_to_ns(c) \
+ ( ((~c) & 0xff000000) | \
+ ((( c) & 0xff0000 ) >> 16) | \
+ (( c) & 0xff00 ) | \
+ ((( c) & 0xff ) << 16))
+
+
+/**
+ * Convert a NetSurf color to a CSS colour primitive
+ *
+ * (1-A)BGR -> ARGB
+ *
+ * \param color The NetSurf color to convert
+ * \return Corresponding CSS colour primitive
+ */
+#define ns_color_to_nscss(c) \
+ ( ((~c) & 0xff000000) | \
+ ((( c) & 0xff0000 ) >> 16) | \
+ (( c) & 0xff00 ) | \
+ ((( c) & 0xff ) << 16))
/**
* Determine if a CSS color primitive is transparent
diff --git a/desktop/system_colour.c b/desktop/system_colour.c
index 7b4fded..4ef1709 100644
--- a/desktop/system_colour.c
+++ b/desktop/system_colour.c
@@ -23,6 +23,7 @@
#include "utils/utils.h"
#include "utils/log.h"
+#include "css/utils.h"
#include "desktop/gui.h"
#include "utils/nsoption.h"
@@ -82,8 +83,6 @@ colour gui_system_colour_char(const char *name)
return ret;
}
-#define ns_color_to_nscss(c) (((0xff - (((c) >> 24) & 0xff)) << 24) |
((c) & 0xFF00) | (((c) >> 16) & 0xFF) | (((c) & 0xFF) << 16))
-
css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
{
unsigned int ccount;
-----------------------------------------------------------------------
Summary of changes:
css/utils.h | 27 +++++++++++++++++++++------
desktop/system_colour.c | 3 +--
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/css/utils.h b/css/utils.h
index 9d40aba..f3131f1 100644
--- a/css/utils.h
+++ b/css/utils.h
@@ -27,17 +27,32 @@ extern css_fixed nscss_screen_dpi;
/**
* Convert a CSS color to a NetSurf colour primitive
- *
+ *
* ARGB -> (1-A)BGR
*
* \param color The CSS color to convert
* \return Corresponding NetSurf colour primitive
*/
-#define nscss_color_to_ns(color) \
- (0xff000000 - ((color) & 0xff000000)) | \
- (((color) & 0xff0000) >> 16) | \
- ((color) & 0xff00) | \
- (((color) & 0xff) << 16)
+#define nscss_color_to_ns(c) \
+ ( ((~c) & 0xff000000) | \
+ ((( c) & 0xff0000 ) >> 16) | \
+ (( c) & 0xff00 ) | \
+ ((( c) & 0xff ) << 16))
+
+
+/**
+ * Convert a NetSurf color to a CSS colour primitive
+ *
+ * (1-A)BGR -> ARGB
+ *
+ * \param color The NetSurf color to convert
+ * \return Corresponding CSS colour primitive
+ */
+#define ns_color_to_nscss(c) \
+ ( ((~c) & 0xff000000) | \
+ ((( c) & 0xff0000 ) >> 16) | \
+ (( c) & 0xff00 ) | \
+ ((( c) & 0xff ) << 16))
/**
* Determine if a CSS color primitive is transparent
diff --git a/desktop/system_colour.c b/desktop/system_colour.c
index 7b4fded..4ef1709 100644
--- a/desktop/system_colour.c
+++ b/desktop/system_colour.c
@@ -23,6 +23,7 @@
#include "utils/utils.h"
#include "utils/log.h"
+#include "css/utils.h"
#include "desktop/gui.h"
#include "utils/nsoption.h"
@@ -82,8 +83,6 @@ colour gui_system_colour_char(const char *name)
return ret;
}
-#define ns_color_to_nscss(c) (((0xff - (((c) >> 24) & 0xff)) << 24) |
((c) & 0xFF00) | (((c) >> 16) & 0xFF) | (((c) & 0xFF) << 16))
-
css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
{
unsigned int ccount;
--
NetSurf Browser