From af75fce2fb87fb0e285b1c876fb14bccb3c0def7 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Mon, 6 Jan 2025 06:29:51 -0500 Subject: simplify --- libwinnie/src/text.cc | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'libwinnie/src/text.cc') diff --git a/libwinnie/src/text.cc b/libwinnie/src/text.cc index 0abe6ac..81fa8d7 100644 --- a/libwinnie/src/text.cc +++ b/libwinnie/src/text.cc @@ -19,11 +19,12 @@ along with this program. If not, see . Author: Eleni Maria Stea */ +#include #include #include +#include #include "sdl/gfx.h" -#include "shalloc.h" #include "text.h" #include "winnie.h" @@ -44,11 +45,11 @@ static Text *text; bool init_text() { - if(!(text = (Text*)sh_malloc(sizeof *text))) { + if(!(text = (Text*)malloc(sizeof *text))) { return false; } - get_subsys()->text_offset = (int)((char*)text - (char*)get_pool()); + get_subsys()->text_offset = (intptr_t)(text); if(FT_Init_FreeType(&text->ft_lib)) { fprintf(stderr, "Failed to initialize the FreeType library!\n"); @@ -72,17 +73,7 @@ bool init_text() void destroy_text() { - sh_free(text); -} - -bool client_open_text(void *smem_start, int offset) -{ - text = (Text*)((unsigned char*)smem_start + offset); - return true; -} - -void client_close_text() -{ + free(text); } void draw_text(const char *txt, Pixmap *pixmap) @@ -126,14 +117,14 @@ static int draw_glyph(Pixmap *pixmap, int x, int y, char c) Rect clipping_rect = get_clipping_rect(); - for(int i=0; irows; i++) { + for(unsigned int i=0; irows; i++) { int dest_y = i + y; if(dest_y >= clipping_rect.y + clipping_rect.height) { break; } if(dest_y >= clipping_rect.y) { - for(int j=0; jwidth; j++) { + for(unsigned int j=0; jwidth; j++) { int dest_x = j + x; if(dest_x >= clipping_rect.x + clipping_rect.width) { -- cgit v1.2.3