diff --git a/src/backend/x11.c b/src/backend/x11.c index 4370b55..3d2b505 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -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; diff --git a/src/text.c b/src/text.c index 87a9a01..7d94e5c 100644 --- a/src/text.c +++ b/src/text.c @@ -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