added inline to static functions

pull/2/head
Sara 2023-05-06 00:05:05 +02:00
parent 76dbc26787
commit d28305920f
1 changed files with 14 additions and 7 deletions

View File

@ -76,7 +76,8 @@ SDL_FRect get_dest_with_size(SDL_FRect untransformed, int ui) {
return r; 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; const sprite_t* sprite = &cmd->sprite;
float fw, fh, fwm, fhm; float fw, fh, fwm, fhm;
get_scaling_factors(&fw, &fh, &fwm, &fhm, cmd->ui); 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); &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; float w, h, wm, hm;
get_scaling_factors(&w, &h, &wm, &hm, cmd->ui); get_scaling_factors(&w, &h, &wm, &hm, cmd->ui);
SDL_FRect rect = (SDL_FRect) { SDL_FRect rect = (SDL_FRect) {
@ -135,7 +137,8 @@ static void _exec_rect_cmd(const drawcmd_t* cmd) {
SDL_RenderFillRectF(g_context.renderer, &r); 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; const nineslice_t* sliced = &cmd->sliced;
// target rect in world space // 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); 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; SDL_FRect r = cmd->text.area;
int fh = TTF_FontHeight(cmd->text.style.font); int fh = TTF_FontHeight(cmd->text.style.font);
int wrap = (int)(fh * r.w / cmd->text.style.size); int wrap = (int)(fh * r.w / cmd->text.style.size);
@ -303,7 +307,8 @@ static drawcmd_delegate const drawcmd_funcs[] = {
&_exec_text_cmd, &_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)); 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) { for(const drawcmd_t* cmd = g_drawdata; cmd != g_drawdata_endptr; ++cmd) {
if(cmd->type > DRAWCMDTYPE_MIN && cmd->type < DRAWCMDTYPE_MAX) { if(cmd->type > DRAWCMDTYPE_MIN && cmd->type < DRAWCMDTYPE_MAX) {
@ -326,7 +331,8 @@ void swap_buffer() {
g_drawdata_endptr = g_drawdata; 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* insertpoint = g_drawdata + index;
drawcmd_t* dest = insertpoint + 1; drawcmd_t* dest = insertpoint + 1;
size_t size = (size_t)(g_drawdata_endptr - g_drawdata); 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; 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) { if(g_drawdata_endptr == g_drawdata) {
_insert_drawcmd_at(0, cmd); _insert_drawcmd_at(0, cmd);
return; return;