aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/CrPFBData.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/CrPFBData.c')
-rw-r--r--nx-X11/lib/X11/CrPFBData.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/nx-X11/lib/X11/CrPFBData.c b/nx-X11/lib/X11/CrPFBData.c
index d343420aa..17d551bb7 100644
--- a/nx-X11/lib/X11/CrPFBData.c
+++ b/nx-X11/lib/X11/CrPFBData.c
@@ -58,33 +58,32 @@ Pixmap XCreatePixmapFromBitmapData(
unsigned long bg,
unsigned int depth)
{
- XImage ximage;
- GC gc;
- XGCValues gcv;
- Pixmap pix;
-
- pix = XCreatePixmap(display, d, width, height, depth);
- gcv.foreground = fg;
- gcv.background = bg;
- gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv);
+ Pixmap pix = XCreatePixmap(display, d, width, height, depth);
+ XGCValues gcv = {
+ .foreground = fg,
+ .background = bg
+ };
+ GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv);
if (gc == NULL) {
XFreePixmap(display, pix);
return (Pixmap) None;
+ } else {
+ XImage ximage = {
+ .height = height,
+ .width = width,
+ .depth = 1,
+ .bits_per_pixel = 1,
+ .xoffset = 0,
+ .format = XYBitmap,
+ .data = data,
+ .byte_order = LSBFirst,
+ .bitmap_unit = 8,
+ .bitmap_bit_order = LSBFirst,
+ .bitmap_pad = 8,
+ .bytes_per_line = (width + 7) / 8
+ };
+ XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height);
+ XFreeGC(display, gc);
+ return(pix);
}
- ximage.height = height;
- ximage.width = width;
- ximage.depth = 1;
- ximage.bits_per_pixel = 1;
- ximage.xoffset = 0;
- ximage.format = XYBitmap;
- ximage.data = data;
- ximage.byte_order = LSBFirst;
- ximage.bitmap_unit = 8;
- ximage.bitmap_bit_order = LSBFirst;
- ximage.bitmap_pad = 8;
- ximage.bytes_per_line = (width+7)/8;
-
- XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height);
- XFreeGC(display, gc);
- return(pix);
}