summaryrefslogtreecommitdiffstatsci
path: root/tests/save_restore.c
blob: c51cf2c4fb97e5751055a7ac38df732c7a6718cb (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
#include "test.h"

void recurse_draw(VkvgContext ctx, int depth) {
    depth++;
    vkvg_save(ctx);

    vkvg_translate(ctx, 5, 5);
    vkvg_rectangle(ctx, (float)depth, (float)depth, 200, 200);
    /*vkvg_clip_preserve(ctx);
    vkvg_set_source_rgb(ctx, 1.f/depth, 1.f / depth, 1.f / depth);
    vkvg_fill_preserve(ctx);*/
    vkvg_set_source_rgb(ctx, 0, 1, 0);
    vkvg_stroke(ctx);

    if (depth < 20)
        recurse_draw(ctx, depth);

    vkvg_restore(ctx);
}

void test() {
    VkvgContext ctx = vkvg_create(surf);

    recurse_draw(ctx, 0);

    vkvg_destroy(ctx);
}

int main(int argc, char *argv[]) {
    no_test_size = true;
    PERFORM_TEST(test, argc, argv);
    return 0;
}