[cairo-commit] cairo/test .cvsignore, 1.5, 1.6 Makefile.am, 1.12,
1.13 clip_twice-ref.png, 1.1, 1.2 coverage-ref.png, 1.3,
1.4 read_png.c, 1.1, 1.2 write_png.c, 1.2, 1.3
Kristian Hogsberg
commit at pdx.freedesktop.org
Thu Jan 27 11:40:31 PST 2005
Committed by: krh
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv30003
Modified Files:
.cvsignore Makefile.am clip_twice-ref.png coverage-ref.png
read_png.c write_png.c
Log Message:
2005-01-27 Kristian Høgsberg <krh at redhat.com>
* test/write_png.c (unpremultiply_data):
* test/read_png.c (premultiply_data):
Fix missing rounding in these two functions.
* test/coverage-ref.png:
* test/clip_twice-ref.png:
Update these to versions with properly rounded alpha values.
* test/Makefile.am: Move clip_twice out of XFAIL now that rounding
works.
* test/.cvsignore: Add new test cases.
Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo/test/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- .cvsignore 25 Jan 2005 22:45:31 -0000 1.5
+++ .cvsignore 27 Jan 2005 19:40:29 -0000 1.6
@@ -9,6 +9,8 @@
move_to_show_surface
text_cache_crash
text_rotate
+coverage
+clip_twice
*-out.png
*-diff.png
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/test/Makefile.am,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile.am 27 Jan 2005 05:46:01 -0000 1.12
+++ Makefile.am 27 Jan 2005 19:40:29 -0000 1.13
@@ -36,8 +36,7 @@
# from premultiplied alpha in the test framework.
XFAIL_TESTS = \
move_to_show_surface \
-text_rotate \
-clip_twice
+text_rotate
check_PROGRAMS = $(TESTS)
Index: clip_twice-ref.png
===================================================================
RCS file: /cvs/cairo/cairo/test/clip_twice-ref.png,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
Binary files /tmp/cvsTvU3Ao and /tmp/cvsXhC8OE differ
Index: coverage-ref.png
===================================================================
RCS file: /cvs/cairo/cairo/test/coverage-ref.png,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
Binary files /tmp/cvsuCej8o and /tmp/cvsP4idoF differ
Index: read_png.c
===================================================================
RCS file: /cvs/cairo/cairo/test/read_png.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- read_png.c 26 Oct 2004 21:38:43 -0000 1.1
+++ read_png.c 27 Jan 2005 19:40:29 -0000 1.2
@@ -47,9 +47,9 @@
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));
}
Index: write_png.c
===================================================================
RCS file: /cvs/cairo/cairo/test/write_png.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- write_png.c 25 Jan 2005 22:45:31 -0000 1.2
+++ write_png.c 27 Jan 2005 19:40:29 -0000 1.3
@@ -46,9 +46,9 @@
if (alpha == 0) {
b[0] = b[1] = b[2] = b[3] = 0;
} else {
- b[0] = (((pixel & 0x0000ff) >> 0) * 255) / alpha;
- b[1] = (((pixel & 0x00ff00) >> 8) * 255) / alpha;
- b[2] = (((pixel & 0xff0000) >> 16) * 255) / alpha;
+ b[0] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha;
+ b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha;
+ b[2] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha;
b[3] = alpha;
}
}
More information about the cairo-commit
mailing list