aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/CrPFBData.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
commit70ac75f4ab184c21d11b9840a47362610aaef481 (patch)
tree183b9ec7e6897fb2cea7296b461a35ca93dfce6e /nx-X11/lib/X11/CrPFBData.c
parent6c303d9e4ffd162b8c7f59a4b135e592d923a656 (diff)
parent70e9d346fe34af127d2c827c3678e53d0f4312ae (diff)
downloadnx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.gz
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.bz2
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.zip
Merge branch 'uli42-pr/libX11_further_backports' into 3.6.x
Attributes GH PR #222: https://github.com/ArcticaProject/nx-libs/pull/222
Diffstat (limited to 'nx-X11/lib/X11/CrPFBData.c')
-rw-r--r--nx-X11/lib/X11/CrPFBData.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/nx-X11/lib/X11/CrPFBData.c b/nx-X11/lib/X11/CrPFBData.c
index 57cd15303..17d551bb7 100644
--- a/nx-X11/lib/X11/CrPFBData.c
+++ b/nx-X11/lib/X11/CrPFBData.c
@@ -58,30 +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;
- if (! (gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv)))
- return (Pixmap) NULL;
- 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);
+ 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);
+ }
}