From d28305920f7e658d17b8027010f9dfe8d1d5bba2 Mon Sep 17 00:00:00 2001 From: Sara Date: Sat, 6 May 2023 00:05:05 +0200 Subject: [PATCH] added inline to static functions --- src/corelib/render.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/corelib/render.c b/src/corelib/render.c index 3be0081..a144493 100644 --- a/src/corelib/render.c +++ b/src/corelib/render.c @@ -76,7 +76,8 @@ SDL_FRect get_dest_with_size(SDL_FRect untransformed, int ui) { return r; } -static void _exec_sprite_cmd(const drawcmd_t* cmd) { +static +void _exec_sprite_cmd(const drawcmd_t* cmd) { const sprite_t* sprite = &cmd->sprite; float fw, fh, fwm, fhm; get_scaling_factors(&fw, &fh, &fwm, &fhm, cmd->ui); @@ -95,7 +96,8 @@ static void _exec_sprite_cmd(const drawcmd_t* cmd) { &sprite->origin,SDL_FLIP_NONE); } -static void _exec_rect_cmd(const drawcmd_t* cmd) { +static +void _exec_rect_cmd(const drawcmd_t* cmd) { float w, h, wm, hm; get_scaling_factors(&w, &h, &wm, &hm, cmd->ui); SDL_FRect rect = (SDL_FRect) { @@ -135,7 +137,8 @@ static void _exec_rect_cmd(const drawcmd_t* cmd) { SDL_RenderFillRectF(g_context.renderer, &r); } -static void _exec_sliced_cmd(const drawcmd_t* cmd) { +static +void _exec_sliced_cmd(const drawcmd_t* cmd) { const nineslice_t* sliced = &cmd->sliced; // target rect in world space @@ -230,7 +233,8 @@ static void _exec_sliced_cmd(const drawcmd_t* cmd) { SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); } -static void _exec_text_cmd(const drawcmd_t* cmd) { +static +void _exec_text_cmd(const drawcmd_t* cmd) { SDL_FRect r = cmd->text.area; int fh = TTF_FontHeight(cmd->text.style.font); int wrap = (int)(fh * r.w / cmd->text.style.size); @@ -303,7 +307,8 @@ static drawcmd_delegate const drawcmd_funcs[] = { &_exec_text_cmd, }; -static void _exec_buffer() { +static inline +void _exec_buffer() { if(d_debug_next_frame) printf("debug capture of draw buffer\ncount: %zu\n", (size_t)(g_drawdata_endptr - g_drawdata)); for(const drawcmd_t* cmd = g_drawdata; cmd != g_drawdata_endptr; ++cmd) { if(cmd->type > DRAWCMDTYPE_MIN && cmd->type < DRAWCMDTYPE_MAX) { @@ -326,7 +331,8 @@ void swap_buffer() { g_drawdata_endptr = g_drawdata; } -static void _insert_drawcmd_at(size_t index, const drawcmd_t* cmd) { +static inline +void _insert_drawcmd_at(size_t index, const drawcmd_t* cmd) { drawcmd_t* insertpoint = g_drawdata + index; drawcmd_t* dest = insertpoint + 1; size_t size = (size_t)(g_drawdata_endptr - g_drawdata); @@ -342,7 +348,8 @@ static void _insert_drawcmd_at(size_t index, const drawcmd_t* cmd) { insertpoint->ui = _render_mode == 1; } -static void _draw(const drawcmd_t* cmd) { +static inline +void _draw(const drawcmd_t* cmd) { if(g_drawdata_endptr == g_drawdata) { _insert_drawcmd_at(0, cmd); return;