aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/radial-perf-test.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-03-25 10:20:34 +0100
committermarha <marha@users.sourceforge.net>2013-04-11 11:13:37 +0200
commitdde22e946ccfb0bd937224daf42403b80528c2a6 (patch)
treec4235cb922c8cd854bc3ef2e670bb6802dc743de /pixman/test/radial-perf-test.c
parentaccd8a3364ffd1e91a4ab52b06b5e3b9d250ae92 (diff)
downloadvcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.tar.gz
vcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.tar.bz2
vcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.zip
fontconfig mesa pixman xserver git update 25 Mar 2013
xserver commit 2967391c6d35f03121afa8003e0fb94b62495129 pixman commit d8ac35af1208a4fa4d67f03fee10b5449fb8495a fontconfig commit b561ff2016ce84eef3c81f16dfb0481be6a13f9b mesa commit 92b8a37fdfff9e83f39b8885f51ed2f60326ab6a
Diffstat (limited to 'pixman/test/radial-perf-test.c')
-rw-r--r--pixman/test/radial-perf-test.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/pixman/test/radial-perf-test.c b/pixman/test/radial-perf-test.c
new file mode 100644
index 000000000..71092e27b
--- /dev/null
+++ b/pixman/test/radial-perf-test.c
@@ -0,0 +1,58 @@
+#include "utils.h"
+#include <stdio.h>
+
+int
+main ()
+{
+ static const pixman_point_fixed_t inner = { 0x0000, 0x0000 };
+ static const pixman_point_fixed_t outer = { 0x0000, 0x0000 };
+ static const pixman_fixed_t r_inner = 0;
+ static const pixman_fixed_t r_outer = 64 << 16;
+ static const pixman_gradient_stop_t stops[] = {
+ { 0x00000, { 0x6666, 0x6666, 0x6666, 0xffff } },
+ { 0x10000, { 0x0000, 0x0000, 0x0000, 0xffff } }
+ };
+ static const pixman_transform_t transform = {
+ { { 0x0, 0x26ee, 0x0},
+ { 0xffffeeef, 0x0, 0x0},
+ { 0x0, 0x0, 0x10000}
+ }
+ };
+ static const pixman_color_t z = { 0x0000, 0x0000, 0x0000, 0x0000 };
+ pixman_image_t *dest, *radial, *zero;
+ int i;
+ double before, after;
+
+ dest = pixman_image_create_bits (
+ PIXMAN_x8r8g8b8, 640, 429, NULL, -1);
+ zero = pixman_image_create_solid_fill (&z);
+ radial = pixman_image_create_radial_gradient (
+ &inner, &outer, r_inner, r_outer, stops, ARRAY_LENGTH (stops));
+ pixman_image_set_transform (radial, &transform);
+ pixman_image_set_repeat (radial, PIXMAN_REPEAT_PAD);
+
+#define N_COMPOSITE 500
+
+ before = gettime();
+ for (i = 0; i < N_COMPOSITE; ++i)
+ {
+ before -= gettime();
+
+ pixman_image_composite (
+ PIXMAN_OP_SRC, zero, NULL, dest,
+ 0, 0, 0, 0, 0, 0, 640, 429);
+
+ before += gettime();
+
+ pixman_image_composite32 (
+ PIXMAN_OP_OVER, radial, NULL, dest,
+ - 150, -158, 0, 0, 0, 0, 640, 361);
+ }
+
+ after = gettime();
+
+ write_png (dest, "radial.png");
+
+ printf ("Average time to composite: %f\n", (after - before) / N_COMPOSITE);
+ return 0;
+}