diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-10-13 22:11:47 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-10-13 22:11:47 +0000 |
commit | 57e3c0748cd3b8ede5ffd721c876a734e264779f (patch) | |
tree | 29a9cefc603b298449875beb081fd879946ee362 | |
parent | 0ed0dfdc3b470cda1cf1a49e454563330ec51c54 (diff) | |
download | netsurf-57e3c0748cd3b8ede5ffd721c876a734e264779f.tar.gz netsurf-57e3c0748cd3b8ede5ffd721c876a734e264779f.tar.bz2 |
Make endian-neutral
svn path=/trunk/netsurf/; revision=13044
-rw-r--r-- | image/nssprite.c | 14 |
1 files 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]; } } |