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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#include "VkvgTest.hpp"
TEST(lines_horizontal) {
float w = (float)test->app->width;
float h = (float)test->app->height;
VkvgContext ctx = vkvg_create(test->surf);
vkvg_clear(ctx);
for (uint32_t i = 0; i < test->app->testSize; i++) {
randomize_color(ctx);
float x1 = w * rndf();
float y1 = h * rndf();
float v = 500.f * rndf();
vkvg_move_to(ctx, x1, y1);
vkvg_line_to(ctx, x1 + v, y1);
vkvg_stroke(ctx);
}
vkvg_destroy(ctx);
}
TEST(lines_vertical) {
float w = (float)test->app->width;
float h = (float)test->app->height;
VkvgContext ctx = vkvg_create(test->surf);
vkvg_clear(ctx);
for (uint32_t i = 0; i < test->app->testSize; i++) {
randomize_color(ctx);
float x1 = w * rndf();
float y1 = h * rndf();
float v = 500.f * rndf();
vkvg_move_to(ctx, x1, y1);
vkvg_line_to(ctx, x1, y1 + v);
vkvg_stroke(ctx);
}
vkvg_destroy(ctx);
}
TEST(lines_horzAndVert) {
float w = (float)test->app->width;
float h = (float)test->app->height;
VkvgContext ctx = vkvg_create(test->surf);
vkvg_clear(ctx);
for (uint32_t i = 0; i < test->app->testSize; i++) {
randomize_color(ctx);
float x1 = w * rndf();
float y1 = h * rndf();
float x2 = (w * rndf()) + 1;
float y2 = (h * rndf()) + 1;
vkvg_move_to(ctx, x1, y1);
vkvg_line_to(ctx, x2, y2);
vkvg_stroke(ctx);
}
vkvg_destroy(ctx);
}
TEST(lines_multilines) {
float w = (float)test->app->width;
float h = (float)test->app->height;
VkvgContext ctx = vkvg_create(test->surf);
vkvg_clear(ctx);
randomize_color(ctx);
for (uint32_t i = 0; i < test->app->testSize; i++) {
float x1 = w * rndf();
float y1 = h * rndf();
float x2 = (w * rndf()) + 1;
float y2 = (h * rndf()) + 1;
vkvg_move_to(ctx, x1, y1);
vkvg_line_to(ctx, x2, y2);
}
vkvg_stroke(ctx);
vkvg_destroy(ctx);
}
TEST(lines_multi_segments) {
float w = (float)test->app->width;
float h = (float)test->app->height;
VkvgContext ctx = vkvg_create(test->surf);
vkvg_clear(ctx);
randomize_color(ctx);
float x1 = w * rndf();
float y1 = h * rndf();
vkvg_move_to(ctx, x1, y1);
for (uint32_t i = 0; i < test->app->testSize; i++) {
x1 = w * rndf();
y1 = h * rndf();
vkvg_line_to(ctx, x1, y1);
}
vkvg_stroke(ctx);
vkvg_destroy(ctx);
}
|