From 57e3c0748cd3b8ede5ffd721c876a734e264779f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 13 Oct 2011 22:11:47 +0000 Subject: Make endian-neutral svn path=/trunk/netsurf/; revision=13044 --- image/nssprite.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/image/nssprite.c b/image/nssprite.c index 7789d8df9..6a1f116b4 100644 --- a/image/nssprite.c +++ b/image/nssprite.c @@ -133,14 +133,12 @@ static bool nssprite_convert(struct content *c) for (uint32_t y = 0; y < sprite->height; y++) { for (uint32_t x = 0; x < sprite->width; x++) { int offset = 4 * (y * sprite->width + x); - uint32_t r = imagebuf[offset+3]; - uint32_t g = imagebuf[offset+2]; - uint32_t b = imagebuf[offset+1]; - uint32_t a = imagebuf[offset]; - imagebuf[offset] = r; - imagebuf[offset+1] = g; - imagebuf[offset+2] = b; - imagebuf[offset+3] = a; + uint32_t rgba = 0; + + rgba |= imagebuf[offset] << 24; + rgba |= imagebuf[offset + 1] << 16; + rgba |= imagebuf[offset + 2] << 8; + rgba |= imagebuf[offset + 3]; } } -- cgit v1.2.3