Commit: e77e88d0818637839135d7de846be84494250eeb
Parent: ae74142b9ce0ebdd3eb686ab4b7b3aaef3bff540
Author: Randy Palamar
Date: Thu, 24 Oct 2024 09:12:44 -0600
drop debug fb and glyph cache dumping
neither of these seem very useful in practice
Diffstat:
M | debug.c | | | 58 | ---------------------------------------------------------- |
M | vtgl.c | | | 8 | -------- |
2 files changed, 0 insertions(+), 66 deletions(-)
diff --git a/debug.c b/debug.c
@@ -93,64 +93,6 @@ dump_lines_to_file(Term *t)
}
static void
-fput_cell(FILE *f, Cell *c)
-{
- s8 s = utf8_encode(c->cp);
- fwrite(s.data, 1, s.len, f);
-}
-
-static void
-dump_fb_to_file(Term *t)
-{
- TermView *tv = t->views + t->view_idx;
- char *fname = "fb.bin";
- FILE *f = fopen(fname, "w");
- if (!f) return;
- printf("dumping fb to %s\n", fname);
- for (u32 r = 0; r < t->size.h; r++) {
- for (u32 c = 0; c < t->size.w; c++)
- fput_cell(f, &tv->fb.rows[r][c]);
- fputc('\n', f);
- }
- fclose(f);
-}
-
-static void
-dump_glyph_cache_to_file(FontAtlas *fa)
-{
- char *fname = "fa.text";
- FILE *f = fopen(fname, "w");
- if (!f) return;
- printf("dumping glyph cache to %s\n", fname);
-
- GlyphCache *gc = &fa->glyph_cache;
- GlyphCacheStats stats = get_and_clear_glyph_cache_stats(gc);
- fputs("Stats:\n", f);
- fprintf(f, "hit: %u\n", stats.hit_count);
- fprintf(f, "miss: %u\n", stats.miss_count);
- fprintf(f, "recycle: %u\n", stats.recycle_count);
-
- u32 count = 0;
- fputs("\nChain:\n", f);
- for (u32 i = gc->glyphs[0].next; i; i = gc->glyphs[i].next) {
- count++;
- fprintf(f, "%u -> ", i);
- }
-
- fprintf(f, "\n\ncount: %u\n\n", count);
-
- fputs("Glyphs:\n", f);
- for (u32 i = gc->glyphs[0].next; i; i = gc->glyphs[i].next) {
- u32 cp = gc->glyphs[i].cp;
- s8 encoded = utf8_encode(cp);
- fwrite(encoded.data, 1, encoded.len, f);
- fputs(" -> ", f);
- }
-
- fclose(f);
-}
-
-static void
debug_init(Term *t, Arena a)
{
/* NOTE: this used to be useful but for now its not */
diff --git a/vtgl.c b/vtgl.c
@@ -612,14 +612,6 @@ key_callback(GLFWwindow *win, i32 key, i32 sc, i32 act, i32 mods)
dump_lines_to_file(t);
return;
}
- if (key == GLFW_KEY_F2 && act == GLFW_PRESS) {
- dump_fb_to_file(t);
- return;
- }
- if (key == GLFW_KEY_F3 && act == GLFW_PRESS) {
- dump_glyph_cache_to_file(&t->fa);
- return;
- }
if (key == GLFW_KEY_F12 && act == GLFW_PRESS) {
t->gl.flags ^= DRAW_DEBUG_OVERLAY;
return;