fix pixmap leak

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@82 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-30 17:47:03 +00:00
parent e74b80da50
commit 8ea2d4a50a
15 changed files with 9359 additions and 1256 deletions

View File

@@ -1,6 +1,8 @@
/* $Id$ */
#include <Mw/Milsko.h>
#include <stb_image.h>
static int hex(const char* txt, int len) {
int i;
int r = 0;
@@ -145,3 +147,17 @@ void MwDrawText(MwWidget handle, MwPoint* point, const char* text, MwLLColor col
sx += fw * sc;
}
}
MwLLPixmap MwLoadImage(MwWidget handle, const char* path) {
int width, height, ch;
unsigned char* rgb = stbi_load(path, &width, &height, &ch, 3);
MwLLPixmap px;
if(rgb == NULL) return NULL;
px = MwLLCreatePixmap(handle->lowlevel, rgb, width, height);
free(rgb);
return px;
}