--- a/src/2d.c Sat Jul 26 21:13:05 2025 +0200 +++ b/src/2d.c Sun Jul 27 23:34:19 2025 +0200 @@ -28,7 +28,6 @@ #include "ascension/2d.h" #include "ascension/constants.h" -#include "ascension/error.h" #include "ascension/shader.h" #include <assert.h> @@ -92,16 +91,12 @@ const bool border = rectangle->thickness > 0; // Compute shader flags - int shader_flags = 0; - // TODO: think about a bool-array to int utility function - if (filled) shader_flags |= ASC_RECTANGLE_SHADER_FLAG_FILL; - if (border) shader_flags |= ASC_RECTANGLE_SHADER_FLAG_BORDER; - if (round) shader_flags |= ASC_RECTANGLE_SHADER_FLAG_ROUND; + int flags = asc_create_flags(1, 3, filled, round, border); // Look up and activate the shader const AscShaderProgram *shader = asc_shader_lookup_or_create( - ASC_SHADER_RECTANGLE(shader_flags), - asc_rectangle_shader_create, shader_flags + ASC_SHADER_RECTANGLE(flags), + asc_rectangle_shader_create, flags ); if (asc_shader_use(shader, camera)) return; asc_cptr_cast(AscRectangleShader, rect_shader, shader); @@ -227,9 +222,7 @@ const bool border = ellipsis->thickness > 0; // Compute shader flags - int shader_flags = 0; - if (filled) shader_flags |= ASC_ELLIPSIS_SHADER_FLAG_FILL; - if (border) shader_flags |= ASC_ELLIPSIS_SHADER_FLAG_BORDER; + int shader_flags = asc_create_flags(1, 2, filled, border); // Look up and activate the shader const AscShaderProgram *shader = asc_shader_lookup_or_create(