aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/Makefile.am230
-rw-r--r--pixman/test/pdf-op-test.c84
2 files changed, 201 insertions, 113 deletions
diff --git a/pixman/test/Makefile.am b/pixman/test/Makefile.am
index f2fbf4ce2..19c4f8006 100644
--- a/pixman/test/Makefile.am
+++ b/pixman/test/Makefile.am
@@ -1,113 +1,117 @@
-AM_CFLAGS = @OPENMP_CFLAGS@
-AM_LDFLAGS = @OPENMP_CFLAGS@
-
-TEST_LDADD = $(top_builddir)/pixman/libpixman-1.la
-INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman
-
-TESTPROGRAMS = \
- a1-trap-test \
- region-test \
- region-translate-test \
- fetch-test \
- oob-test \
- trap-crasher \
- alpha-loop \
- scaling-crash-test \
- gradient-crash-test \
- alphamap \
- stress-test \
- blitters-test \
- scaling-test \
- affine-test \
- composite
-
-a1_trap_test_LDADD = $(TEST_LDADD)
-fetch_test_LDADD = $(TEST_LDADD)
-trap_crasher_LDADD = $(TEST_LDADD)
-oob_test_LDADD = $(TEST_LDADD)
-scaling_crash_test_LDADD = $(TEST_LDADD)
-region_translate_test_LDADD = $(TEST_LDADD)
-
-region_test_LDADD = $(TEST_LDADD)
-region_test_SOURCES = region-test.c utils.c utils.h
-
-blitters_test_LDADD = $(TEST_LDADD)
-blitters_test_SOURCES = blitters-test.c utils.c utils.h
-
-scaling_test_LDADD = $(TEST_LDADD)
-scaling_test_SOURCES = scaling-test.c utils.c utils.h
-
-affine_test_LDADD = $(TEST_LDADD)
-affine_test_SOURCES = affine-test.c utils.c utils.h
-
-alphamap_LDADD = $(TEST_LDADD)
-alphamap_SOURCES = alphamap.c utils.c utils.h
-
-alpha_loop_LDADD = $(TEST_LDADD)
-alpha_loop_SOURCES = alpha-loop.c utils.c utils.h
-
-composite_LDADD = $(TEST_LDADD)
-composite_SOURCES = composite.c utils.c utils.h
-
-gradient_crash_test_LDADD = $(TEST_LDADD)
-gradient_crash_test_SOURCES = gradient-crash-test.c utils.c utils.h
-
-stress_test_LDADD = $(TEST_LDADD)
-stress_test_SOURCES = stress-test.c utils.c utils.h
-
-# GTK using test programs
-
-if HAVE_GTK
-
-GTK_LDADD = $(TEST_LDADD) $(GTK_LIBS)
-GTK_UTILS = gtk-utils.c gtk-utils.h
-
-TESTPROGRAMS_GTK = \
- clip-test \
- clip-in \
- composite-test \
- gradient-test \
- alpha-test \
- screen-test \
- convolution-test \
- trap-test
-
-INCLUDES += $(GTK_CFLAGS)
-
-gradient_test_LDADD = $(GTK_LDADD)
-gradient_test_SOURCES = gradient-test.c $(GTK_UTILS)
-
-alpha_test_LDADD = $(GTK_LDADD)
-alpha_test_SOURCES = alpha-test.c $(GTK_UTILS)
-
-composite_test_LDADD = $(GTK_LDADD)
-composite_test_SOURCES = composite-test.c $(GTK_UTILS)
-
-clip_test_LDADD = $(GTK_LDADD)
-clip_test_SOURCES = clip-test.c $(GTK_UTILS)
-
-clip_in_LDADD = $(GTK_LDADD)
-clip_in_SOURCES = clip-in.c $(GTK_UTILS)
-
-trap_test_LDADD = $(GTK_LDADD)
-trap_test_SOURCES = trap-test.c $(GTK_UTILS)
-
-screen_test_LDADD = $(GTK_LDADD)
-screen_test_SOURCES = screen-test.c $(GTK_UTILS)
-
-convolution_test_LDADD = $(GTK_LDADD)
-convolution_test_SOURCES = convolution-test.c $(GTK_UTILS)
-
-endif
-
-# Benchmarks
-
-BENCHMARKS = \
- lowlevel-blt-bench
-
-lowlevel_blt_bench_SOURCES = lowlevel-blt-bench.c utils.c utils.h
-lowlevel_blt_bench_LDADD = $(TEST_LDADD)
-
-noinst_PROGRAMS = $(TESTPROGRAMS) $(TESTPROGRAMS_GTK) $(BENCHMARKS)
-
-TESTS = $(TESTPROGRAMS)
+AM_CFLAGS = @OPENMP_CFLAGS@
+AM_LDFLAGS = @OPENMP_CFLAGS@
+
+TEST_LDADD = $(top_builddir)/pixman/libpixman-1.la -lm
+INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman
+
+TESTPROGRAMS = \
+ a1-trap-test \
+ pdf-op-test \
+ region-test \
+ region-translate-test \
+ fetch-test \
+ oob-test \
+ trap-crasher \
+ alpha-loop \
+ scaling-crash-test \
+ gradient-crash-test \
+ alphamap \
+ stress-test \
+ blitters-test \
+ scaling-test \
+ affine-test \
+ composite
+
+a1_trap_test_LDADD = $(TEST_LDADD)
+fetch_test_LDADD = $(TEST_LDADD)
+trap_crasher_LDADD = $(TEST_LDADD)
+oob_test_LDADD = $(TEST_LDADD)
+scaling_crash_test_LDADD = $(TEST_LDADD)
+region_translate_test_LDADD = $(TEST_LDADD)
+
+pdf_op_test_LDADD = $(TEST_LDADD)
+pdf_op_test_SOURCES = pdf-op-test.c utils.c utils.h
+
+region_test_LDADD = $(TEST_LDADD)
+region_test_SOURCES = region-test.c utils.c utils.h
+
+blitters_test_LDADD = $(TEST_LDADD)
+blitters_test_SOURCES = blitters-test.c utils.c utils.h
+
+scaling_test_LDADD = $(TEST_LDADD)
+scaling_test_SOURCES = scaling-test.c utils.c utils.h
+
+affine_test_LDADD = $(TEST_LDADD)
+affine_test_SOURCES = affine-test.c utils.c utils.h
+
+alphamap_LDADD = $(TEST_LDADD)
+alphamap_SOURCES = alphamap.c utils.c utils.h
+
+alpha_loop_LDADD = $(TEST_LDADD)
+alpha_loop_SOURCES = alpha-loop.c utils.c utils.h
+
+composite_LDADD = $(TEST_LDADD)
+composite_SOURCES = composite.c utils.c utils.h
+
+gradient_crash_test_LDADD = $(TEST_LDADD)
+gradient_crash_test_SOURCES = gradient-crash-test.c utils.c utils.h
+
+stress_test_LDADD = $(TEST_LDADD)
+stress_test_SOURCES = stress-test.c utils.c utils.h
+
+# GTK using test programs
+
+if HAVE_GTK
+
+GTK_LDADD = $(TEST_LDADD) $(GTK_LIBS)
+GTK_UTILS = gtk-utils.c gtk-utils.h
+
+TESTPROGRAMS_GTK = \
+ clip-test \
+ clip-in \
+ composite-test \
+ gradient-test \
+ alpha-test \
+ screen-test \
+ convolution-test \
+ trap-test
+
+INCLUDES += $(GTK_CFLAGS)
+
+gradient_test_LDADD = $(GTK_LDADD)
+gradient_test_SOURCES = gradient-test.c $(GTK_UTILS)
+
+alpha_test_LDADD = $(GTK_LDADD)
+alpha_test_SOURCES = alpha-test.c $(GTK_UTILS)
+
+composite_test_LDADD = $(GTK_LDADD)
+composite_test_SOURCES = composite-test.c $(GTK_UTILS)
+
+clip_test_LDADD = $(GTK_LDADD)
+clip_test_SOURCES = clip-test.c $(GTK_UTILS)
+
+clip_in_LDADD = $(GTK_LDADD)
+clip_in_SOURCES = clip-in.c $(GTK_UTILS)
+
+trap_test_LDADD = $(GTK_LDADD)
+trap_test_SOURCES = trap-test.c $(GTK_UTILS)
+
+screen_test_LDADD = $(GTK_LDADD)
+screen_test_SOURCES = screen-test.c $(GTK_UTILS)
+
+convolution_test_LDADD = $(GTK_LDADD)
+convolution_test_SOURCES = convolution-test.c $(GTK_UTILS)
+
+endif
+
+# Benchmarks
+
+BENCHMARKS = \
+ lowlevel-blt-bench
+
+lowlevel_blt_bench_SOURCES = lowlevel-blt-bench.c utils.c utils.h
+lowlevel_blt_bench_LDADD = $(TEST_LDADD)
+
+noinst_PROGRAMS = $(TESTPROGRAMS) $(TESTPROGRAMS_GTK) $(BENCHMARKS)
+
+TESTS = $(TESTPROGRAMS)
diff --git a/pixman/test/pdf-op-test.c b/pixman/test/pdf-op-test.c
new file mode 100644
index 000000000..dc7a4fd0b
--- /dev/null
+++ b/pixman/test/pdf-op-test.c
@@ -0,0 +1,84 @@
+#include <config.h>
+#include <stdlib.h>
+#include "utils.h"
+
+static const pixman_op_t pdf_ops[] =
+{
+ PIXMAN_OP_MULTIPLY,
+ PIXMAN_OP_SCREEN,
+ PIXMAN_OP_OVERLAY,
+ PIXMAN_OP_DARKEN,
+ PIXMAN_OP_LIGHTEN,
+ PIXMAN_OP_COLOR_DODGE,
+ PIXMAN_OP_COLOR_BURN,
+ PIXMAN_OP_HARD_LIGHT,
+ PIXMAN_OP_SOFT_LIGHT,
+ PIXMAN_OP_DIFFERENCE,
+ PIXMAN_OP_EXCLUSION,
+ PIXMAN_OP_HSL_HUE,
+ PIXMAN_OP_HSL_SATURATION,
+ PIXMAN_OP_HSL_COLOR,
+ PIXMAN_OP_HSL_LUMINOSITY
+};
+
+static const uint32_t pixels[] =
+{
+ 0x00808080,
+ 0x80123456,
+ 0x00000000,
+ 0xffffffff,
+ 0x00ffffff,
+ 0x80808080,
+ 0x00123456,
+};
+
+int
+main ()
+{
+ int o, s, m, d;
+
+ enable_fp_exceptions();
+
+ for (o = 0; o < ARRAY_LENGTH (pdf_ops); ++o)
+ {
+ pixman_op_t op = pdf_ops[o];
+
+ for (s = 0; s < ARRAY_LENGTH (pixels); ++s)
+ {
+ pixman_image_t *src;
+
+ src = pixman_image_create_bits (
+ PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[s]), 4);
+
+ for (m = -1; m < ARRAY_LENGTH (pixels); ++m)
+ {
+ pixman_image_t *msk = NULL;
+ if (m >= 0)
+ {
+ msk = pixman_image_create_bits (
+ PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[m]), 4);
+ }
+
+ for (d = 0; d < ARRAY_LENGTH (pixels); ++d)
+ {
+ pixman_image_t *dst;
+ uint32_t dp = pixels[d];
+
+ dst = pixman_image_create_bits (
+ PIXMAN_a8r8g8b8, 1, 1, &dp, 4);
+
+ pixman_image_composite (op, src, msk, dst,
+ 0, 0, 0, 0, 0, 0, 1, 1);
+
+ pixman_image_unref (dst);
+ }
+ if (msk)
+ pixman_image_unref (msk);
+ }
+
+ pixman_image_unref (src);
+ }
+ }
+
+ return 0;
+}