From 2bde0221929c9774f48d5c3b3b1a28d304a9ff41 Mon Sep 17 00:00:00 2001 From: Ian Osgood Date: Wed, 19 Apr 2006 20:42:46 -0700 Subject: [PATCH] Enumeration and documentation for col parameter --- neko/Makefile | 6 ++---- neko/xcbneko.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/neko/Makefile b/neko/Makefile index 089f915..7aa7abf 100644 --- a/neko/Makefile +++ b/neko/Makefile @@ -1,7 +1,5 @@ -CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -LIBS = -lxcb -lXCBAux -lXCBICCCM -lXCBAtom -lXCBKeysyms +CFLAGS = `pkg-config --cflags xcb` -g -Wall -Wpointer-arith -Wstrict-prototypes +LIBS = `pkg-config --libs xcb-aux xcb-icccm xcb-atom xcb-keysyms` -lm xcbneko: xcbneko.c $(CC) $(CFLAGS) xcbneko.c $(LIBS) -o xcbneko - -all: xcbneko diff --git a/neko/xcbneko.c b/neko/xcbneko.c index ea12c6e..f254e2b 100644 --- a/neko/xcbneko.c +++ b/neko/xcbneko.c @@ -423,17 +423,23 @@ XCBPIXMAP CreatePixmapFromBitmapData( XCBConnection *c, /* must swap and pad the data if bit/byte_order isn't LSB (Mac) */ /* Mac X Server: byte_order=bit_order=MSB, unit=32, padding=32 */ - long bufLen = (w+7)/8*h; + long bpl = (w+7)/8; + long pad = XCBGetSetup(c)->bitmap_format_scanline_pad; + long bpd = ROUNDUP(w, pad)>>3; + long bufLen = bpd * h; BYTE buf[1024]; if (XCBGetSetup(c)->bitmap_format_scanline_unit == 32 && XCBGetSetup(c)->bitmap_format_bit_order == XCBImageOrderMSBFirst && XCBGetSetup(c)->image_byte_order == XCBImageOrderMSBFirst) { - long bpl = (w+7)/8; - long pad = XCBGetSetup(c)->bitmap_format_scanline_pad; - long bpd = ROUNDUP(w, pad)>>3; - SwapBits((unsigned char *)data, (unsigned char *)buf, bpl, bpl, bpd, h); - bufLen = bpd * h; + SwapBits((unsigned char *)data, buf, bpl, bpl, bpd, h); + } + else if (bpl != bpd) + { + int i; + BYTE *src = (BYTE *)data, *dest = buf; + for (i=0; i