summaryrefslogtreecommitdiffstatsci
path: root/src/mask.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2013-10-28 13:38:08 -0700
committerBryce Harrington <b.harrington@samsung.com>2013-10-30 18:10:04 -0700
commit5ba31b6f73ce490f69a28ffe27d8e80994849198 (patch)
tree90c2a7e7184f1829aa2ffc45cfe8b1d84b5464f7 /src/mask.cpp
parentb2356653469b7ea05cf6bcb92d4ac4dc23f2b5ab (diff)
Make the caskbench executable run the individual tests
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;
+}