diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-06-29 23:08:04 -0700 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:26 +0200 |
commit | 97b9864eabf7930e6d72c11a4d35182ef3bd3828 (patch) | |
tree | 2cc2cb2e60ac73134d260ca9c2fde77e364c1b67 /nx-X11 | |
parent | 7a8721b8a7c6d8b11f1223a8a06ccbfe97ad7352 (diff) | |
download | nx-libs-97b9864eabf7930e6d72c11a4d35182ef3bd3828.tar.gz nx-libs-97b9864eabf7930e6d72c11a4d35182ef3bd3828.tar.bz2 nx-libs-97b9864eabf7930e6d72c11a4d35182ef3bd3828.zip |
Convert XCreate{Pix,Bit}map...Data to use C99 designated initializers
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/lib/X11/CrBFData.c | 42 | ||||
-rw-r--r-- | nx-X11/lib/X11/CrPFBData.c | 49 |
2 files changed, 44 insertions, 47 deletions
diff --git a/nx-X11/lib/X11/CrBFData.c b/nx-X11/lib/X11/CrBFData.c index 95158755f..6708a9b91 100644 --- a/nx-X11/lib/X11/CrBFData.c +++ b/nx-X11/lib/X11/CrBFData.c @@ -53,30 +53,28 @@ Pixmap XCreateBitmapFromData( unsigned int width, unsigned int height) { - XImage ximage; - GC gc; - Pixmap pix; - - pix = XCreatePixmap(display, d, width, height, 1); - gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); + Pixmap pix = XCreatePixmap(display, d, width, height, 1); + GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); 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 = XYPixmap, + .data = (char *) 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 = XYPixmap; - ximage.data = (char *)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); } 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); } |