summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-10-16 14:46:41 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-10-16 14:46:41 +0000
commit66ccdd3efa97a42d3bb1ae2766c6826afc9ca7e6 (patch)
tree30e08587a1c9b51576a5ad14b06a74ba1a052f80
parent49b70147d174a834d4d7e11407565bf927228e4e (diff)
downloadnetsurf-66ccdd3efa97a42d3bb1ae2766c6826afc9ca7e6.tar.gz
netsurf-66ccdd3efa97a42d3bb1ae2766c6826afc9ca7e6.tar.bz2
Simplify
svn path=/trunk/netsurf/; revision=10889
-rw-r--r--image/webp.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/image/webp.c b/image/webp.c
index ea96c1e43..56d1a5008 100644
--- a/image/webp.c
+++ b/image/webp.c
@@ -50,7 +50,7 @@ bool webp_convert(struct content *c)
unsigned long size;
uint8 *Y = NULL, *U = NULL, *V = NULL;
int width = 0, height = 0;
- long x = 0, y = 0, offset = 0;
+ uint32 offset = 0;
uint8 r, g, b, a;
char title[100];
WebPResult res = webp_success;
@@ -88,18 +88,16 @@ bool webp_convert(struct content *c)
/* Decoded data is RGBA on both big- and little-endian platforms,
* so ensure correct byte order. */
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- offset = 4 * (y * width + x);
- imagebufptr = imagebuf + offset;
+ size = width * height * 4;
- a = imagebuf[offset+3];
- b = imagebuf[offset+2];
- g = imagebuf[offset+1];
- r = imagebuf[offset];
+ for (offset = 0; offset < size; offset += 4) {
+ a = imagebuf[offset+3];
+ b = imagebuf[offset+2];
+ g = imagebuf[offset+1];
+ r = imagebuf[offset];
- *imagebufptr = r << 24 | g << 16 | b << 8 | a;
- }
+ imagebufptr = imagebuf + offset;
+ *imagebufptr = r << 24 | g << 16 | b << 8 | a;
}
c->width = width;