summaryrefslogtreecommitdiffstatsci
path: root/src/mask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mask.cpp')
-rw-r--r--src/mask.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/mask.cpp b/src/mask.cpp
index b1906ac..9c49fb5 100644
--- a/src/mask.cpp
+++ b/src/mask.cpp
@@ -2,32 +2,26 @@
#include <stdlib.h>
#include <cairo.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include "caskbench.h"
-int
-main(int argc, char *argv[]) {
- int i;
- int loops = 128*1024;
- cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 800, 80);
- cairo_t *cr = cairo_create (surface);
- cairo_pattern_t *mask;
-
- cairo_set_source_rgb (cr, 0, 0.5, 0);
- cairo_paint (cr);
+static cairo_pattern_t *mask;
- srand(0xdeadbeef);
+int
+setup_mask(cairo_t *cr)
+{
mask = cairo_pattern_create_rgba (0, 0, 0, 0.5);
+ return 1;
+}
- while (loops--) {
- cairo_mask (cr, mask);
- }
-
- cairo_destroy (cr);
- cairo_surface_write_to_png (surface, "mask.png");
- cairo_surface_destroy (surface);
+void
+teardown_mask(void)
+{
cairo_pattern_destroy (mask);
- return 0;
}
+int
+test_mask(cairo_t *cr)
+{
+ cairo_mask (cr, mask);
+ return 1;
+}