diff src/core/debug.c @ 94:ed72843a7194

core: simplify font/texture interfaces Expose the structure to avoid calling functions and heap allocations. While here remove some useless functions.
author David Demelier <markand@malikania.fr>
date Mon, 30 Mar 2020 13:34:42 +0200
parents 8f95462ac5f8
children
line wrap: on
line diff
--- a/src/core/debug.c	Thu Mar 26 10:28:11 2020 +0100
+++ b/src/core/debug.c	Mon Mar 30 13:34:42 2020 +0200
@@ -51,21 +51,23 @@
 	assert(fmt);
 
 	char line[DEBUG_LINE_MAX];
-	struct texture *tex;
+	struct texture tex;
 	struct font *font;
 	unsigned int gapy;
 
 	vsnprintf(line, sizeof (line), fmt, ap);
+
 	font = report->font ? report->font : debug_options.default_font;
-	tex = font_render_ex(font, line, report->color, report->style);
+	font->color = report->color;
+	font->style = report->style;
 
-	if (!tex)
+	if (!font_render(font, &tex, line))
 		return;
 
 	gapy = (PADDING_Y * (report->count)) +
 	    (font_height(font) * (report->count));
 	report->count++;
 
-	texture_draw(tex, PADDING_X, gapy);
-	texture_close(tex);
+	texture_draw(&tex, PADDING_X, gapy);
+	texture_finish(&tex);
 }