1 This patch fixes an inability to GRAB or display XWD files on the eXceed
2 X server running in 24-bits. It may also fix GRAB problems on other X
3 servers. It shouldn't *break* anything, and as such, can and should be
6 The bits_per_item of the returned XImage is less than bits_per_pixel, which
7 is wrong, as far as I can tell. (Hard to really know, as the X11 docs aren't
8 at *all* clear on the subject.) I do know that it breaks my code, and the netpbm
9 code, and god only knows what else.
11 Maybe they're wrong, maybe I'm wrong - who knows. In any event, this patch
12 fixes it, as far as XV is concerned.
14 Thanks to Nadim Saeed (nadim@xlnt.com)!
20 *** xvgrab.c.orig Thu Oct 7 10:41:15 1999
21 --- xvgrab.c Thu Oct 7 12:03:36 1999
26 bits_per_item = image->bitmap_unit;
27 - bits_used = bits_per_item;
28 bits_per_pixel = image->bits_per_pixel;
30 if (bits_per_pixel == 32) pixmask = 0xffffffff;
31 else pixmask = (((CARD32) 1) << bits_per_pixel) - 1;
35 bits_per_item = image->bitmap_unit;
36 bits_per_pixel = image->bits_per_pixel;
39 + /* add code for freako 'exceed' server, where bitmapunit = 8
40 + and bitsperpix = 32 (and depth=24)... */
42 + if (bits_per_item < bits_per_pixel) {
43 + bits_per_item = bits_per_pixel;
45 + /* round bits_per_item up to next legal value, if necc */
46 + if (bits_per_item < 8) bits_per_item = 8;
47 + else if (bits_per_item < 16) bits_per_item = 16;
48 + else bits_per_item = 32;
52 + /* which raises the question: how (can?) you ever have a 24 bits per pix,
53 + (ie, 3 bytes, no alpha/padding) */
56 + bits_used = bits_per_item; /* so it will get a new item first time */
58 if (bits_per_pixel == 32) pixmask = 0xffffffff;
59 else pixmask = (((CARD32) 1) << bits_per_pixel) - 1;
63 *** xvxwd.c.orig Thu Oct 7 12:13:09 1999
64 --- xvxwd.c Thu Oct 7 12:13:13 1999
69 bits_per_item = h11P->bitmap_unit;
70 - bits_used = bits_per_item;
71 bits_per_pixel = h11P->bits_per_pixel;
72 byte_order = h11P->byte_order;
73 bit_order = h11P->bitmap_bit_order;
75 if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1;
76 else pixel_mask = (1 << bits_per_pixel) - 1;
81 bits_per_item = h11P->bitmap_unit;
82 bits_per_pixel = h11P->bits_per_pixel;
83 byte_order = h11P->byte_order;
84 bit_order = h11P->bitmap_bit_order;
87 + /* add sanity-code for freako 'exceed' server, where bitmapunit = 8
88 + and bitsperpix = 32 (and depth=24)... */
90 + if (bits_per_item < bits_per_pixel) {
91 + bits_per_item = bits_per_pixel;
93 + /* round bits_per_item up to next legal value, if necc */
94 + if (bits_per_item < 8) bits_per_item = 8;
95 + else if (bits_per_item < 16) bits_per_item = 16;
96 + else bits_per_item = 32;
100 + /* which raises the question: how (can?) you ever have a 24 bits per pix,
101 + (ie, 3 bytes, no alpha/padding) */
104 + bits_used = bits_per_item;
106 if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1;
107 else pixel_mask = (1 << bits_per_pixel) - 1;