summaryrefslogtreecommitdiff
path: root/test/read-png.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/read-png.c')
-rw-r--r--test/read-png.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/read-png.c b/test/read-png.c
index 23f91e831..e7e2a92ca 100644
--- a/test/read-png.c
+++ b/test/read-png.c
@@ -47,9 +47,9 @@ premultiply_data (png_structp png,
unsigned char alpha = base[3];
unsigned long p;
- red = (unsigned) red * (unsigned) alpha / 255;
- green = (unsigned) green * (unsigned) alpha / 255;
- blue = (unsigned) blue * (unsigned) alpha / 255;
+ red = ((unsigned) red * (unsigned) alpha + 127) / 255;
+ green = ((unsigned) green * (unsigned) alpha + 127) / 255;
+ blue = ((unsigned) blue * (unsigned) alpha + 127) / 255;
p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
memcpy (base, &p, sizeof (unsigned long));
}