Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7

The branch, master has been updated
       via  328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7 (commit)
      from  f04cedef1c7742f38b0b561efcd77e0476fcbf60 (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=328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7
commit 328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RSVG: fix colour conversion

diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index ca2d81e..2ba1b49 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -39,6 +39,8 @@
 #include <librsvg/rsvg-cairo.h>
 #endif
 
+#include <nsutils/endian.h>
+
 #include "utils/log.h"
 #include "utils/utils.h"
 #include "utils/messages.h"
@@ -139,15 +141,21 @@ static inline void rsvg_argb_to_abgr(uint8_t *pixels,
                int width, int height, size_t rowstride)
 {
        uint8_t *p = pixels;
+       int boff = 0, roff = 2;
+
+       if (endian_host_is_le() == false) {
+               boff = 1;
+               roff = 3;
+       }
 
        for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                        /* Swap R and B */
-                       const uint8_t r = p[x+3];
+                       const uint8_t r = p[4*x+roff];
 
-                       p[x+3] = p[x];
+                       p[4*x+roff] = p[4*x+boff];
 
-                       p[x] = r;
+                       p[4*x+boff] = r;
                }
 
                p += rowstride;


-----------------------------------------------------------------------

Summary of changes:
 content/handlers/image/rsvg.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index ca2d81e..2ba1b49 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -39,6 +39,8 @@
 #include <librsvg/rsvg-cairo.h>
 #endif
 
+#include <nsutils/endian.h>
+
 #include "utils/log.h"
 #include "utils/utils.h"
 #include "utils/messages.h"
@@ -139,15 +141,21 @@ static inline void rsvg_argb_to_abgr(uint8_t *pixels,
                int width, int height, size_t rowstride)
 {
        uint8_t *p = pixels;
+       int boff = 0, roff = 2;
+
+       if (endian_host_is_le() == false) {
+               boff = 1;
+               roff = 3;
+       }
 
        for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                        /* Swap R and B */
-                       const uint8_t r = p[x+3];
+                       const uint8_t r = p[4*x+roff];
 
-                       p[x+3] = p[x];
+                       p[4*x+roff] = p[4*x+boff];
 
-                       p[x] = r;
+                       p[4*x+boff] = r;
                }
 
                p += rowstride;


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to