summaryrefslogtreecommitdiffstatsci
path: root/src/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.cpp')
-rw-r--r--src/image.cpp48
1 files changed, 16 insertions, 32 deletions
diff --git a/src/image.cpp b/src/image.cpp
index 35e9cca..c9b9c1c 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -2,44 +2,28 @@
#include <stdlib.h>
#include <cairo.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include "caskbench.h"
-void
-randomize_color(cairo_t *cr)
-{
- double red, green, blue, alpha;
-
- red = (double)rand()/RAND_MAX;
- green = (double)rand()/RAND_MAX;
- blue = (double)rand()/RAND_MAX;
- alpha = (double)rand()/RAND_MAX;
-
- cairo_set_source_rgba (cr, red, green, blue, alpha);
-}
+static cairo_surface_t *image;
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_surface_t *image;
- cairo_t *cr = cairo_create (surface);
-
- srand(0xdeadbeef);
-
+setup_image(cairo_t *cr)
+{
image = cairo_image_surface_create_from_png ("../data/romedalen.png");
cairo_set_source_surface (cr, image, 0, 0);
+ return 1;
+}
- while (loops--) {
- cairo_paint (cr);
- }
-
- cairo_destroy (cr);
- cairo_surface_write_to_png (surface, "image.png");
- cairo_surface_destroy (surface);
+void
+teardown_image(void)
+{
cairo_surface_destroy (image);
- return 0;
}
+int
+test_image(cairo_t *cr)
+{
+ cairo_paint (cr);
+ return 1;
+}
+