diff --git a/src/rendering/twn_draw.c b/src/rendering/twn_draw.c index cf7af86..0712206 100644 --- a/src/rendering/twn_draw.c +++ b/src/rendering/twn_draw.c @@ -329,6 +329,7 @@ static void render_2d(void) { break; case PRIMITIVE_2D_LINES: render_lines(&invocation.primitive->line); + stbds_arrfreef(invocation.primitive->line.vertices); break; case PRIMITIVE_2D_TEXT: default: diff --git a/src/rendering/twn_draw_c.h b/src/rendering/twn_draw_c.h index 9ffc99f..988012a 100644 --- a/src/rendering/twn_draw_c.h +++ b/src/rendering/twn_draw_c.h @@ -322,7 +322,7 @@ IndexBuffer get_circle_element_buffer(void); void render_circle(const CirclePrimitive *circle); -void render_lines(LinePrimitive *line); +void render_lines(const LinePrimitive *line); void render_rectangle(const RectPrimitive *rectangle); diff --git a/src/rendering/twn_lines.c b/src/rendering/twn_lines.c index c5e282b..08eed66 100644 --- a/src/rendering/twn_lines.c +++ b/src/rendering/twn_lines.c @@ -46,7 +46,7 @@ void draw_line(Vec2 start, } -void render_lines(LinePrimitive *line) { +void render_lines(LinePrimitive const *line) { DeferredCommandDraw command = {0}; VertexBuffer buffer = get_scratch_vertex_array(); @@ -68,7 +68,7 @@ void render_lines(LinePrimitive *line) { .buffer = buffer }; - command.primitive_count = arrlenu(line->vertices); + command.primitive_count = (uint32_t)arrlenu(line->vertices); command.geometry_mode = DEFERRED_COMMAND_DRAW_GEOMETRY_MODE_LINES; command.pipeline = PIPELINE_2D; @@ -81,7 +81,5 @@ void render_lines(LinePrimitive *line) { .draw = command }; - /* TODO: should it be deleted here? */ - arrfree(line->vertices); arrpush(deferred_commands, final_command); } diff --git a/src/twn_util.c b/src/twn_util.c index 40d88c2..d711d95 100644 --- a/src/twn_util.c +++ b/src/twn_util.c @@ -181,13 +181,10 @@ bool file_exists(const char *path) { void textures_dump_atlases(void) { PHYSFS_mkdir("/dump"); - /* TODO: png instead of bmp */ - const char string_template[] = "/dump/atlas%zd.bmp"; - size_t i = 0; for (; i < arrlenu(ctx.texture_cache.atlas_surfaces); ++i) { char *buf = NULL; - SDL_asprintf(&buf, string_template, i); + SDL_asprintf(&buf, "/dump/atlas%zd.bmp", (ssize_t)i); SDL_RWops *handle = PHYSFSRWOPS_openWrite(buf); diff --git a/src/twn_workers.c b/src/twn_workers.c index 3a0c010..963d388 100644 --- a/src/twn_workers.c +++ b/src/twn_workers.c @@ -1,9 +1,8 @@ -#include "twn_util.h" #include "twn_workers_c.h" #include "rendering/twn_draw_c.h" #ifndef __EMSCRIPTEN__ -SDL_sem *workers_job_semaphore; +static SDL_sem *workers_job_semaphore; static SDL_mutex *workers_mutex; static SDL_sem *workers_exit_semaphore; /* should come to count of `workers_pool_size` */