1/* -*- mode: C; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
2
3#include <gsk/gskcairoblurprivate.h>
4
5static void
6init_surface (cairo_t *cr)
7{
8 int w = cairo_image_surface_get_width (surface: cairo_get_target (cr));
9 int h = cairo_image_surface_get_height (surface: cairo_get_target (cr));
10
11 cairo_set_source_rgb (cr, red: 0, green: 0, blue: 0);
12 cairo_fill (cr);
13
14 cairo_set_source_rgb (cr, red: 1, green: 1, blue: 1);
15 cairo_arc (cr, xc: w/2, yc: h/2, radius: w/2, angle1: 0, angle2: 2*G_PI);
16 cairo_fill (cr);
17}
18
19int
20main (int argc, char **argv)
21{
22 cairo_surface_t *surface;
23 cairo_t *cr;
24 GTimer *timer;
25 double msec;
26 int i, j;
27 int size;
28
29 timer = g_timer_new ();
30
31 size = 2000;
32
33 surface = cairo_image_surface_create (format: CAIRO_FORMAT_A8, width: size, height: size);
34
35 cr = cairo_create (target: surface);
36
37 /* We do everything three times, first two as warmup */
38 for (j = 0; j < 2; j++)
39 {
40 for (i = 1; i < 16; i++)
41 {
42 init_surface (cr);
43 g_timer_start (timer);
44 gsk_cairo_blur_surface (surface, radius: i, flags: GSK_BLUR_X | GSK_BLUR_Y);
45 msec = g_timer_elapsed (timer, NULL) * 1000;
46 if (j == 1)
47 g_print (format: "Radius %2d: %.2f msec, %.2f kpixels/msec:\n", i, msec, size*size/(msec*1000));
48 }
49 }
50
51 g_timer_destroy (timer);
52
53 return 0;
54}
55

source code of gtk/tests/blur-performance.c