summaryrefslogtreecommitdiffstatsci
path: root/src/skia-tests/rectangles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/skia-tests/rectangles.cpp')
-rw-r--r--src/skia-tests/rectangles.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/skia-tests/rectangles.cpp b/src/skia-tests/rectangles.cpp
new file mode 100644
index 0000000..f6fc2bc
--- /dev/null
+++ b/src/skia-tests/rectangles.cpp
@@ -0,0 +1,39 @@
+#include "SkBitmap.h"
+#include "SkBitmapDevice.h"
+#include "SkPaint.h"
+#include "SkRect.h"
+#include <cairo.h>
+
+#include "caskbench.h"
+
+int
+sk_setup_rectangles(caskbench_context_t *ctx)
+{
+ ctx->paint->setARGB(255, 255, 255, 255);
+ return 1;
+}
+
+int
+sk_test_rectangles(caskbench_context_t *ctx)
+{
+ int i, x, y, w, h;
+ SkRect rect;
+
+ for (i=0; i<ctx->size; i++) {
+ ctx->paint->setColor(rand());
+ w = (0.5*(double)ctx->canvas_width*rand())/RAND_MAX + 1;
+ h = (0.5*(double)ctx->canvas_height*rand())/RAND_MAX + 1;
+ x = (0.5*(double)ctx->canvas_width*rand())/RAND_MAX;
+ y = (0.5*(double)ctx->canvas_height*rand())/RAND_MAX;
+ rect.set(x, y, x+w, y+h);
+ ctx->paint->setStrokeWidth(1);
+ ctx->canvas->drawRect(rect, *(ctx->paint));
+ }
+
+ return 1;
+}
+
+void
+sk_teardown_rectangles(void)
+{
+}