]>
Commit | Line | Data |
---|---|---|
c1f0ee65 JR |
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 | |
4 | applied by everybody. | |
5 | ||
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. | |
10 | ||
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. | |
13 | ||
14 | Thanks to Nadim Saeed (nadim@xlnt.com)! | |
15 | ||
16 | --jhb | |
17 | ||
18 | ||
19 | ||
20 | *** xvgrab.c.orig Thu Oct 7 10:41:15 1999 | |
21 | --- xvgrab.c Thu Oct 7 12:03:36 1999 | |
22 | *************** | |
23 | *** 641,648 **** | |
24 | ||
25 | ||
26 | bits_per_item = image->bitmap_unit; | |
27 | - bits_used = bits_per_item; | |
28 | bits_per_pixel = image->bits_per_pixel; | |
29 | ||
30 | if (bits_per_pixel == 32) pixmask = 0xffffffff; | |
31 | else pixmask = (((CARD32) 1) << bits_per_pixel) - 1; | |
32 | --- 641,667 ---- | |
33 | ||
34 | ||
35 | bits_per_item = image->bitmap_unit; | |
36 | bits_per_pixel = image->bits_per_pixel; | |
37 | + | |
38 | + | |
39 | + /* add code for freako 'exceed' server, where bitmapunit = 8 | |
40 | + and bitsperpix = 32 (and depth=24)... */ | |
41 | + | |
42 | + if (bits_per_item < bits_per_pixel) { | |
43 | + bits_per_item = bits_per_pixel; | |
44 | + | |
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; | |
49 | + } | |
50 | + | |
51 | + | |
52 | + /* which raises the question: how (can?) you ever have a 24 bits per pix, | |
53 | + (ie, 3 bytes, no alpha/padding) */ | |
54 | + | |
55 | + | |
56 | + bits_used = bits_per_item; /* so it will get a new item first time */ | |
57 | ||
58 | if (bits_per_pixel == 32) pixmask = 0xffffffff; | |
59 | else pixmask = (((CARD32) 1) << bits_per_pixel) - 1; | |
60 | ||
61 | ||
62 | ||
63 | *** xvxwd.c.orig Thu Oct 7 12:13:09 1999 | |
64 | --- xvxwd.c Thu Oct 7 12:13:13 1999 | |
65 | *************** | |
66 | *** 396,406 **** | |
67 | h11P->pixmap_width; | |
68 | ||
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; | |
74 | ||
75 | if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1; | |
76 | else pixel_mask = (1 << bits_per_pixel) - 1; | |
77 | ||
78 | --- 396,425 ---- | |
79 | h11P->pixmap_width; | |
80 | ||
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; | |
85 | ||
86 | + | |
87 | + /* add sanity-code for freako 'exceed' server, where bitmapunit = 8 | |
88 | + and bitsperpix = 32 (and depth=24)... */ | |
89 | + | |
90 | + if (bits_per_item < bits_per_pixel) { | |
91 | + bits_per_item = bits_per_pixel; | |
92 | + | |
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; | |
97 | + } | |
98 | + | |
99 | + | |
100 | + /* which raises the question: how (can?) you ever have a 24 bits per pix, | |
101 | + (ie, 3 bytes, no alpha/padding) */ | |
102 | + | |
103 | + | |
104 | + bits_used = bits_per_item; | |
105 | + | |
106 | if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1; | |
107 | else pixel_mask = (1 << bits_per_pixel) - 1; | |
108 |