diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-07-15 13:48:04 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-07-15 13:48:04 +0200 |
| commit | a77dc464f91da554b5952ea965aa4b65cb0a511f (patch) | |
| tree | 62c72758c7298600aa920a1e7b343670ea207086 /tests/random_cirles.c | |
| parent | e6b3bfbe53dbb850414ec7904b9f00e1aacc330d (diff) | |
copy tests from masternewvx-post-transform
Diffstat (limited to 'tests/random_cirles.c')
| -rw-r--r-- | tests/random_cirles.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/tests/random_cirles.c b/tests/random_cirles.c index 9c78f63..9004961 100644 --- a/tests/random_cirles.c +++ b/tests/random_cirles.c @@ -1,38 +1,33 @@ #include "test.h" void test(){ - vkvg_surface_clear(surf); - struct timeval currentTime; - gettimeofday(¤tTime, NULL); + vkvg_surface_clear(surf); + struct timeval currentTime; + gettimeofday(¤tTime, NULL); - srand((unsigned) currentTime.tv_usec); - const float w = 800.f; + srand((unsigned) currentTime.tv_usec); + const float w = 800.f; - VkvgContext ctx = vkvg_create(surf); - //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD); + VkvgContext ctx = vkvg_create(surf); + vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD); - vkvg_set_line_width(ctx, 1.0f); - //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL); + vkvg_set_line_width(ctx, 1.0f); + //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL); - for (uint i=0; i<test_size; i++) { - randomize_color(ctx); + for (uint32_t i=0; i<test_size; i++) { + randomize_color(ctx); - float r = 0.5f*w*rand()/RAND_MAX; - float x = truncf(0.5f * w*rand()/RAND_MAX + r); - float y = truncf(0.5f * w*rand()/RAND_MAX + r); + float r = 0.5f*w*rand()/RAND_MAX; + float x = truncf(0.5f * w*rand()/RAND_MAX + r); + float y = truncf(0.5f * w*rand()/RAND_MAX + r); - vkvg_arc(ctx, x, y, r, 0, M_PI * 2.0f); - //vkvg_fill(ctx); - vkvg_fill_preserve(ctx); - randomize_color(ctx); - vkvg_stroke(ctx); - } - vkvg_destroy(ctx); + vkvg_arc(ctx, x, y, r, 0, M_PIF * 2.0f); + vkvg_fill(ctx); + } + vkvg_destroy(ctx); } int main(int argc, char *argv[]) { - - perform_test (test, 1024, 768); - - return 0; + PERFORM_TEST(test, argc, argv); + return 0; } |