eliminate a bit of duplicate font cache lookups in code view build, + eliminate unnecessary per-box color lookups

This commit is contained in:
Ryan Fleury
2025-05-13 15:11:41 -07:00
parent e10f0489da
commit 258b45a837
5 changed files with 92 additions and 79 deletions
+18 -12
View File
@@ -2584,21 +2584,27 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
{
box->tags_key = ui_state->tags_key_stack_top->key;
}
if(ui_state->background_color_stack.top != &ui_state->background_color_nil_stack_top)
if(box->flags & UI_BoxFlag_DrawBackground)
{
box->background_color = ui_state->background_color_stack.top->v;
if(ui_state->background_color_stack.top != &ui_state->background_color_nil_stack_top)
{
box->background_color = ui_state->background_color_stack.top->v;
}
else
{
box->background_color = ui_color_from_name(str8_lit("background"));
}
}
else
if(box->flags & UI_BoxFlag_DrawText)
{
box->background_color = ui_color_from_name(str8_lit("background"));
}
if(ui_state->text_color_stack.top != &ui_state->text_color_nil_stack_top)
{
box->text_color = ui_state->text_color_stack.top->v;
}
else
{
box->text_color = ui_color_from_name(str8_lit("text"));
if(ui_state->text_color_stack.top != &ui_state->text_color_nil_stack_top)
{
box->text_color = ui_state->text_color_stack.top->v;
}
else
{
box->text_color = ui_color_from_name(str8_lit("text"));
}
}
}