eliminate remaining usage code of old theme system; to not pay the cost of slower-path color lookups for every single syntax highlighted thing in the UI, just introduce 'code color slots', which are computed once per window per frame

This commit is contained in:
Ryan Fleury committed 2025-05-02 11:34:24 -07:00
1 parent 2b12239300
commit adf2eabba7
6 files changed
+106 -2263

No files matched your search

+6 -15
View File
@@ -409,12 +409,6 @@ struct RD_RegsNode
////////////////////////////////
//~ rjf: Structured Theme Types, Parsed From Config
typedef struct RD_Theme RD_Theme;
struct RD_Theme
{
Vec4F32 colors[RD_ThemeColor_COUNT];
};
typedef enum RD_FontSlot
{
RD_FontSlot_Main,
@@ -450,7 +444,8 @@ struct RD_WindowState
Rng2F32 last_window_rect;
// rjf: theme (recomputed each frame)
UI_Theme *theme;
UI_Theme *theme;
Vec4F32 theme_code_colors[RD_CodeColorSlot_COUNT];
// rjf: font raster flags (recomputed each frame)
FNT_RasterFlags font_slot_raster_flags[RD_FontSlot_COUNT];
@@ -603,10 +598,6 @@ struct RD_State
// rjf: slot -> font tag map (constructed from-scratch each frame)
FNT_Tag font_slot_table[RD_FontSlot_COUNT];
// rjf: theme target (constructed from-scratch each frame)
RD_Theme *theme;
RD_Theme *theme_target;
// rjf: meta name -> eval type key map (constructed from-scratch each frame)
E_String2TypeKeyMap *meta_name2type_map;
@@ -969,10 +960,10 @@ internal void rd_set_autocomp_regs_(RD_Regs *regs);
////////////////////////////////
//~ rjf: Colors, Fonts, Config
//- rjf: colors
internal Vec4F32 rd_rgba_from_theme_color(RD_ThemeColor color);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);
//- rjf: colors
internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot);
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind);
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);
//- rjf: fonts
internal FNT_Tag rd_font_from_slot(RD_FontSlot slot);