From: Jean-Philippe Bruyère Date: Sun, 20 Feb 2022 18:02:31 +0000 (+0100) Subject: add multithreaded test for text X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=25bcfbe8a5be82da9c4f7420bbcce1b6f7349436;p=jp%2Fvkvg.git add multithreaded test for text --- diff --git a/tests/multithreading/threaded_text.c b/tests/multithreading/threaded_text.c new file mode 100644 index 0000000..bacf597 --- /dev/null +++ b/tests/multithreading/threaded_text.c @@ -0,0 +1,83 @@ +/* + * multiple contexts in separate thread on temp surface for each thread + * guarded blit on final surface. + */ +#include "test.h" +#include "tinycthread.h" + +#define THREAD_COUNT 16 + +static int finishedThreadCount = 0; +static mtx_t* pmutex; + +void drawRandomRect (VkvgContext ctx, float s) { + float w = (float)test_width; + float h = (float)test_height; + randomize_color(ctx); + + float x = truncf(w*rndf()); + float y = truncf(h*rndf()); + + vkvg_rectangle(ctx, x, y, s, s); +} + +int _single_font_and_size () { + VkvgSurface s = vkvg_surface_create(device, test_width, test_height); + VkvgContext ctx = vkvg_create(s); + vkvg_clear(ctx); + for (uint32_t i=0; i