gdkimage-x11: 1-bit images use their byte order for the bits too

This commit is contained in:
Daemonratte 2026-10-15 11:30:51 +02:00
commit 02716d0767
No known key found for this signature in database

View file

@ -270,6 +270,13 @@ _gdk_image_new_for_depth (GdkScreen *screen,
goto error;
}
/* GdkImage has one byte order for bytes and bits; a server
* whose bitmap bit order differs gets an unshared image,
* which Xlib converts */
if (private->ximage->bits_per_pixel == 1 &&
private->ximage->bitmap_bit_order != private->ximage->byte_order)
goto error;
x_shm_info->shmid = shmget (IPC_PRIVATE,
private->ximage->bytes_per_line * private->ximage->height,
IPC_CREAT | 0600);
@ -335,6 +342,8 @@ _gdk_image_new_for_depth (GdkScreen *screen,
case GDK_IMAGE_NORMAL:
private->ximage = XCreateImage (screen_x11->xdisplay, xvisual, depth,
ZPixmap, 0, NULL, width, height, 32, 0);
if (private->ximage->bits_per_pixel == 1)
private->ximage->bitmap_bit_order = private->ximage->byte_order;
/* Use malloc, not g_malloc here, because X will call free()
* on this data