blob: 15bf5634710f61329179d854a78ed31192832ca0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// From http://www.atoker.com/blog/2008/09/06/skia-graphics-library-in-chrome-first-impressions/
#include "SkBitmap.h"
#include "SkBitmapDevice.h"
#include "SkPaint.h"
#include "SkRect.h"
#include <cairo.h>
#include "caskbench.h"
static SkRect r;
int
sk_setup_stroke(caskbench_context_t *ctx)
{
ctx->paint->setARGB(255, 255, 255, 255);
r.set(10, 10, 20, 20);
return 1;
}
int
sk_test_stroke(caskbench_context_t *ctx)
{
int i, x, w, prev_w;
x = 0;
prev_w = 0;
for (i=0; i<32; i++) {
ctx->paint->setColor(rand());
w = (32.0*rand())/RAND_MAX + 1;
x += 4 + (prev_w + w)/2.0;
ctx->paint->setStrokeWidth(w);
ctx->canvas->drawLine(x,10, x,70, *(ctx->paint));
prev_w = w;
}
return 1;
}
void
sk_teardown_stroke(void)
{
}
|