improvement

This commit is contained in:
NishiOwO
2025-12-12 17:51:26 +09:00
parent 0c8715ec9f
commit f9c0ec987e
2 changed files with 6 additions and 4 deletions

View File

@@ -581,8 +581,6 @@ static void MwLLSetTitleImpl(MwLL handle, const char* title) {
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int width, int height) {
MwLLPixmap r = malloc(sizeof(*r));
char* di = malloc(4 * width * height);
char* dm = malloc(4 * width * height);
int evbase, erbase;
XWindowAttributes attr;
@@ -603,8 +601,11 @@ static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int wid
r->x11.use_xrender = XRenderQueryExtension(handle->x11.display, &evbase, &erbase) ? 1 : 0;
#endif
r->x11.image = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), r->x11.depth, ZPixmap, 0, di, width, height, 32, width * 4);
r->x11.mask = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, dm, width, height, 32, width * 4);
r->x11.image = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), r->x11.depth, ZPixmap, 0, NULL, width, height, 32, 0);
r->x11.mask = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, NULL, width, height, 32, 0);
r->x11.image->data = malloc(r->x11.image->bytes_per_line * height);
r->x11.mask->data = malloc(r->x11.mask->bytes_per_line * height);
MwLLPixmapUpdate(r);
return r;

View File

@@ -292,6 +292,7 @@ static int ttf_MwTextHeight(MwWidget handle, int count) {
#endif
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
if(strlen(text) == 0) return;
#ifdef TTF
if(ttf_MwDrawText(handle, point, text, bold, align, color))
#endif