comparison src/fringe.c @ 53936:4dd0e0a7fd9e

(struct fringe_bitmap): Change member bits from char to short to facilitate 16 bits wide bitmaps. Modify all standard bitmaps accordingly. (BYTES_PER_BITMAP_ROW, STANDARD_BITMAP_HEIGHT): New macros. (FRBITS): Use STANDARD_BITMAP_HEIGHT instead of just sizeof. (draw_fringe_bitmap): Ditto. (init_fringe_bitmap) [MAC_OS]: Don't bitswap. (init_fringe_bitmap) [HAVE_X_WINDOWS]: Enhance bitswapping to handle up to 16 bits wide bitmaps. (Fdefine_fringe_bitmap): Doc fix. Handle wider bitmaps.
author Kim F. Storm <storm@cua.dk>
date Fri, 13 Feb 2004 23:28:52 +0000
parents 5d607f751ba3
children 33cf8d1b409d
comparison
equal deleted inserted replaced
53935:60bbfcb6328e 53936:4dd0e0a7fd9e
71 ALIGN_BITMAP_BOTTOM 71 ALIGN_BITMAP_BOTTOM
72 }; 72 };
73 73
74 struct fringe_bitmap 74 struct fringe_bitmap
75 { 75 {
76 unsigned char *bits; 76 unsigned short *bits;
77 unsigned height : 8; 77 unsigned height : 8;
78 unsigned width : 8; 78 unsigned width : 8;
79 unsigned period : 8; 79 unsigned period : 8;
80 unsigned align : 2; 80 unsigned align : 2;
81 unsigned dynamic : 1; 81 unsigned dynamic : 1;
97 ...xx... 97 ...xx...
98 ........ 98 ........
99 ...xx... 99 ...xx...
100 ...xx... 100 ...xx...
101 */ 101 */
102 static unsigned char unknown_bits[] = { 102 static unsigned short unknown_bits[] = {
103 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; 103 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18};
104 104
105 /* An arrow like this: `<-'. */ 105 /* An arrow like this: `<-'. */
106 /* 106 /*
107 ...xx... 107 ...xx...
111 xxxxxx.. 111 xxxxxx..
112 .xx..... 112 .xx.....
113 ..xx.... 113 ..xx....
114 ...xx... 114 ...xx...
115 */ 115 */
116 static unsigned char left_arrow_bits[] = { 116 static unsigned short left_arrow_bits[] = {
117 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18}; 117 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
118 118
119 119
120 /* Right truncation arrow bitmap `->'. */ 120 /* Right truncation arrow bitmap `->'. */
121 /* 121 /*
126 ..xxxxxx 126 ..xxxxxx
127 .....xx. 127 .....xx.
128 ....xx.. 128 ....xx..
129 ...xx... 129 ...xx...
130 */ 130 */
131 static unsigned char right_arrow_bits[] = { 131 static unsigned short right_arrow_bits[] = {
132 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18}; 132 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
133 133
134 134
135 /* Up arrow bitmap. */ 135 /* Up arrow bitmap. */
136 /* 136 /*
141 ...xx... 141 ...xx...
142 ...xx... 142 ...xx...
143 ...xx... 143 ...xx...
144 ...xx... 144 ...xx...
145 */ 145 */
146 static unsigned char up_arrow_bits[] = { 146 static unsigned short up_arrow_bits[] = {
147 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18}; 147 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18};
148 148
149 149
150 /* Down arrow bitmap. */ 150 /* Down arrow bitmap. */
151 /* 151 /*
156 xxxxxxxx 156 xxxxxxxx
157 .xxxxxx. 157 .xxxxxx.
158 ..xxxx.. 158 ..xxxx..
159 ...xx... 159 ...xx...
160 */ 160 */
161 static unsigned char down_arrow_bits[] = { 161 static unsigned short down_arrow_bits[] = {
162 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18}; 162 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18};
163 163
164 /* Marker for continued lines. */ 164 /* Marker for continued lines. */
165 /* 165 /*
166 ..xxxx.. 166 ..xxxx..
170 ..xxxxxx 170 ..xxxxxx
171 ..xxxxx. 171 ..xxxxx.
172 ..xxxx.. 172 ..xxxx..
173 ..xxxxx. 173 ..xxxxx.
174 */ 174 */
175 static unsigned char continued_bits[] = { 175 static unsigned short continued_bits[] = {
176 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; 176 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
177 177
178 /* Marker for continuation lines. */ 178 /* Marker for continuation lines. */
179 /* 179 /*
180 ..xxxx.. 180 ..xxxx..
184 xxxxxx.. 184 xxxxxx..
185 .xxxxx.. 185 .xxxxx..
186 ..xxxx.. 186 ..xxxx..
187 .xxxxx.. 187 .xxxxx..
188 */ 188 */
189 static unsigned char continuation_bits[] = { 189 static unsigned short continuation_bits[] = {
190 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; 190 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
191 191
192 /* Overlay arrow bitmap. A triangular arrow. */ 192 /* Overlay arrow bitmap. A triangular arrow. */
193 /* 193 /*
194 xx...... 194 xx......
198 xxxxxx.. 198 xxxxxx..
199 xxxxx... 199 xxxxx...
200 xxxx.... 200 xxxx....
201 xx...... 201 xx......
202 */ 202 */
203 static unsigned char ov_bits[] = { 203 static unsigned short ov_bits[] = {
204 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0}; 204 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0};
205 205
206 #if 0 206 #if 0
207 /* Reverse Overlay arrow bitmap. A triangular arrow. */ 207 /* Reverse Overlay arrow bitmap. A triangular arrow. */
208 /* 208 /*
213 ..xxxxxx 213 ..xxxxxx
214 ...xxxxx 214 ...xxxxx
215 ....xxxx 215 ....xxxx
216 ......xx 216 ......xx
217 */ 217 */
218 static unsigned char rev_ov_bits[] = { 218 static unsigned short rev_ov_bits[] = {
219 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03}; 219 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03};
220 #endif 220 #endif
221 221
222 /* First line bitmap. An top-left angle. */ 222 /* First line bitmap. An top-left angle. */
223 /* 223 /*
228 xx...... 228 xx......
229 xx...... 229 xx......
230 xx...... 230 xx......
231 ........ 231 ........
232 */ 232 */
233 static unsigned char top_left_angle_bits[] = { 233 static unsigned short top_left_angle_bits[] = {
234 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00}; 234 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00};
235 235
236 /* First line bitmap. An right-up angle. */ 236 /* First line bitmap. An right-up angle. */
237 /* 237 /*
238 ..xxxxxx 238 ..xxxxxx
242 ......xx 242 ......xx
243 ......xx 243 ......xx
244 ......xx 244 ......xx
245 ........ 245 ........
246 */ 246 */
247 static unsigned char top_right_angle_bits[] = { 247 static unsigned short top_right_angle_bits[] = {
248 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00}; 248 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00};
249 249
250 /* Last line bitmap. An left-down angle. */ 250 /* Last line bitmap. An left-down angle. */
251 /* 251 /*
252 ........ 252 ........
256 xx...... 256 xx......
257 xx...... 257 xx......
258 xxxxxx.. 258 xxxxxx..
259 xxxxxx.. 259 xxxxxx..
260 */ 260 */
261 static unsigned char bottom_left_angle_bits[] = { 261 static unsigned short bottom_left_angle_bits[] = {
262 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc}; 262 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
263 263
264 /* Last line bitmap. An right-down angle. */ 264 /* Last line bitmap. An right-down angle. */
265 /* 265 /*
266 ........ 266 ........
270 ......xx 270 ......xx
271 ......xx 271 ......xx
272 ..xxxxxx 272 ..xxxxxx
273 ..xxxxxx 273 ..xxxxxx
274 */ 274 */
275 static unsigned char bottom_right_angle_bits[] = { 275 static unsigned short bottom_right_angle_bits[] = {
276 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f}; 276 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f};
277 277
278 /* First/last line bitmap. An left bracket. */ 278 /* First/last line bitmap. An left bracket. */
279 /* 279 /*
280 xxxxxx.. 280 xxxxxx..
286 xx...... 286 xx......
287 xx...... 287 xx......
288 xxxxxx.. 288 xxxxxx..
289 xxxxxx.. 289 xxxxxx..
290 */ 290 */
291 static unsigned char left_bracket_bits[] = { 291 static unsigned short left_bracket_bits[] = {
292 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc}; 292 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
293 293
294 /* First/last line bitmap. An right bracket. */ 294 /* First/last line bitmap. An right bracket. */
295 /* 295 /*
296 ..xxxxxx 296 ..xxxxxx
302 ......xx 302 ......xx
303 ......xx 303 ......xx
304 ..xxxxxx 304 ..xxxxxx
305 ..xxxxxx 305 ..xxxxxx
306 */ 306 */
307 static unsigned char right_bracket_bits[] = { 307 static unsigned short right_bracket_bits[] = {
308 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f}; 308 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f};
309 309
310 /* Filled box cursor bitmap. A filled box; max 13 pixels high. */ 310 /* Filled box cursor bitmap. A filled box; max 13 pixels high. */
311 /* 311 /*
312 xxxxxxx. 312 xxxxxxx.
321 xxxxxxx. 321 xxxxxxx.
322 xxxxxxx. 322 xxxxxxx.
323 xxxxxxx. 323 xxxxxxx.
324 xxxxxxx. 324 xxxxxxx.
325 */ 325 */
326 static unsigned char filled_box_cursor_bits[] = { 326 static unsigned short filled_box_cursor_bits[] = {
327 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; 327 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
328 328
329 /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */ 329 /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */
330 /* 330 /*
331 xxxxxxx. 331 xxxxxxx.
340 x.....x. 340 x.....x.
341 x.....x. 341 x.....x.
342 x.....x. 342 x.....x.
343 xxxxxxx. 343 xxxxxxx.
344 */ 344 */
345 static unsigned char hollow_box_cursor_bits[] = { 345 static unsigned short hollow_box_cursor_bits[] = {
346 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe}; 346 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe};
347 347
348 /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */ 348 /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */
349 /* 349 /*
350 xx...... 350 xx......
359 xx...... 359 xx......
360 xx...... 360 xx......
361 xx...... 361 xx......
362 xx...... 362 xx......
363 */ 363 */
364 static unsigned char bar_cursor_bits[] = { 364 static unsigned short bar_cursor_bits[] = {
365 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}; 365 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0};
366 366
367 /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */ 367 /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */
368 /* 368 /*
369 xxxxxxx. 369 xxxxxxx.
370 xxxxxxx. 370 xxxxxxx.
371 */ 371 */
372 static unsigned char hbar_cursor_bits[] = { 372 static unsigned short hbar_cursor_bits[] = {
373 0xfe, 0xfe}; 373 0xfe, 0xfe};
374 374
375 375
376 /* Bitmap drawn to indicate lines not displaying text if 376 /* Bitmap drawn to indicate lines not displaying text if
377 `indicate-empty-lines' is non-nil. */ 377 `indicate-empty-lines' is non-nil. */
381 ........ 381 ........
382 ........ 382 ........
383 ..xxxx.. 383 ..xxxx..
384 ........ 384 ........
385 */ 385 */
386 static unsigned char zv_bits[] = { 386 static unsigned short zv_bits[] = {
387 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 387 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
388 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 388 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
389 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 389 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
390 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 390 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
391 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 391 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
400 .x....x. 400 .x....x.
401 .x....x. 401 .x....x.
402 .x....x. 402 .x....x.
403 .xxxxxx. 403 .xxxxxx.
404 */ 404 */
405 static unsigned char hollow_square_bits[] = { 405 static unsigned short hollow_square_bits[] = {
406 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e}; 406 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e};
407 407
408 408
409 409 #define BYTES_PER_BITMAP_ROW (sizeof (unsigned short))
410 #define FRBITS(bits) bits, sizeof bits 410 #define STANDARD_BITMAP_HEIGHT(bits) (sizeof (bits)/BYTES_PER_BITMAP_ROW)
411 #define FRBITS(bits) bits, STANDARD_BITMAP_HEIGHT (bits)
412
411 struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = 413 struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
412 { 414 {
413 { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */ 415 { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */
414 { FRBITS (unknown_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, 416 { FRBITS (unknown_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
415 { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, 417 { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
602 int cursor = NO_FRINGE_BITMAP; 604 int cursor = NO_FRINGE_BITMAP;
603 605
604 switch (w->phys_cursor_type) 606 switch (w->phys_cursor_type)
605 { 607 {
606 case HOLLOW_BOX_CURSOR: 608 case HOLLOW_BOX_CURSOR:
607 if (row->visible_height >= sizeof(hollow_box_cursor_bits)) 609 if (row->visible_height >= STANDARD_BITMAP_HEIGHT (hollow_box_cursor_bits))
608 cursor = HOLLOW_BOX_CURSOR_BITMAP; 610 cursor = HOLLOW_BOX_CURSOR_BITMAP;
609 else 611 else
610 cursor = HOLLOW_SQUARE_BITMAP; 612 cursor = HOLLOW_SQUARE_BITMAP;
611 break; 613 break;
612 case FILLED_BOX_CURSOR: 614 case FILLED_BOX_CURSOR:
1009 return Qnil; 1011 return Qnil;
1010 } 1012 }
1011 1013
1012 1014
1013 /* Initialize bitmap bit. 1015 /* Initialize bitmap bit.
1014 On X and MAC, we bit-swap the built-in bitmaps. 1016
1015 On W32, there's no need to do this. 1017 On X, we bit-swap the built-in bitmaps and reduce bitmap
1018 from short to char array if width is <= 8 bits.
1019
1020 On W32 and MAC, there's no need to do this.
1016 */ 1021 */
1017 1022
1018 void 1023 void
1019 init_fringe_bitmap (which, fb, once_p) 1024 init_fringe_bitmap (which, fb, once_p)
1020 enum fringe_bitmap_type which; 1025 enum fringe_bitmap_type which;
1021 struct fringe_bitmap *fb; 1026 struct fringe_bitmap *fb;
1022 int once_p; 1027 int once_p;
1023 { 1028 {
1024 if (once_p || fb->dynamic) 1029 if (once_p || fb->dynamic)
1025 { 1030 {
1026 #if defined (HAVE_X_WINDOWS) || defined (MAC_OS) 1031 #if defined (HAVE_X_WINDOWS)
1027 unsigned char *bits = fb->bits; 1032 static unsigned char swap_nibble[16]
1033 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
1034 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
1035 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
1036 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */
1037 unsigned short *bits = fb->bits;
1028 int j; 1038 int j;
1029 for (j = 0; j < fb->height; j++) 1039
1030 { 1040 if (fb->width <= 8)
1031 static unsigned char swap_nibble[16] 1041 {
1032 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */ 1042 unsigned char *cbits = (unsigned char *)fb->bits;
1033 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */ 1043 for (j = 0; j < fb->height; j++)
1034 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */ 1044 {
1035 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */ 1045 unsigned short b = *bits++;
1036 1046 unsigned char c;
1037 unsigned char b = *bits; 1047 c = (unsigned char)((swap_nibble[b & 0xf] << 4)
1038 *bits++ = (unsigned short)((swap_nibble[b & 0xf]<<4) 1048 | (swap_nibble[(b>>4) & 0xf]));
1039 | (swap_nibble[(b>>4) & 0xf])); 1049 *cbits++ = (c >> (8 - fb->width));
1050 }
1051 }
1052 else
1053 {
1054 for (j = 0; j < fb->height; j++)
1055 {
1056 unsigned short b = *bits;
1057 b = (unsigned short)((swap_nibble[b & 0xf] << 12)
1058 | (swap_nibble[(b>>4) & 0xf] << 8)
1059 | (swap_nibble[(b>>8) & 0xf] << 4)
1060 | (swap_nibble[(b>>12) & 0xf]));
1061 *bits++ = (b >> (16 - fb->width));
1062 }
1040 } 1063 }
1041 #endif 1064 #endif
1042 } 1065 }
1043 1066
1044 if (!once_p) 1067 if (!once_p)
1056 1079
1057 1080
1058 DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap, 1081 DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
1059 1, 5, 0, 1082 1, 5, 0,
1060 doc: /* Define a fringe bitmap from BITS of height HEIGHT and width WIDTH. 1083 doc: /* Define a fringe bitmap from BITS of height HEIGHT and width WIDTH.
1061 BITS is either a string or a vector. If HEIGHT is nil, use number of bytes 1084 BITS is either a string or a vector of integers.
1062 in BITS. If WIDTH is zero, default to 8. Optional forth arg ALIGN may be 1085 HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS.
1063 one of `top', `center', or `bottom', indicating the positioning of the 1086 WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
1064 bitmap relative to the rows where it is used; the default is to center the 1087 Optional forth arg ALIGN may be one of `top', `center', or `bottom',
1065 bitmap. Fourth arg may also be a list (ALIGN PERIODIC) where 1088 indicating the positioning of the bitmap relative to the rows where it
1066 PERIODIC non-nil specifies that the bitmap should be repeated. 1089 is used; the default is to center the bitmap. Fourth arg may also be a
1090 list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
1091 should be repeated.
1067 Optional fifth argument WHICH is bitmap number to redefine. 1092 Optional fifth argument WHICH is bitmap number to redefine.
1068 Return new bitmap number, or nil of no more free bitmap slots. */) 1093 Return new bitmap number, or nil of no more free bitmap slots. */)
1069 (bits, height, width, align, which) 1094 (bits, height, width, align, which)
1070 Lisp_Object bits, height, width, align, which; 1095 Lisp_Object bits, height, width, align, which;
1071 { 1096 {
1072 Lisp_Object len; 1097 Lisp_Object len;
1073 int n, h, i, j; 1098 int n, h, i, j;
1074 unsigned char *b; 1099 unsigned short *b;
1075 struct fringe_bitmap fb, *xfb; 1100 struct fringe_bitmap fb, *xfb;
1076 int fill1 = 0, fill2 = 0; 1101 int fill1 = 0, fill2 = 0;
1077 1102
1078 if (!STRINGP (bits) && !VECTORP (bits)) 1103 if (!STRINGP (bits) && !VECTORP (bits))
1079 bits = wrong_type_argument (Qstringp, bits); 1104 bits = wrong_type_argument (Qstringp, bits);
1150 error ("Invalid fringe bitmap number"); 1175 error ("Invalid fringe bitmap number");
1151 } 1176 }
1152 1177
1153 fb.dynamic = 1; 1178 fb.dynamic = 1;
1154 1179
1155 xfb = (struct fringe_bitmap *)xmalloc (sizeof fb + fb.height); 1180 xfb = (struct fringe_bitmap *)xmalloc (sizeof fb
1156 fb.bits = b = (unsigned char *)(xfb+1); 1181 + fb.height * BYTES_PER_BITMAP_ROW);
1182 fb.bits = b = (unsigned short *)(xfb+1);
1157 bzero (b, fb.height); 1183 bzero (b, fb.height);
1158 1184
1159 j = 0; 1185 j = 0;
1160 while (j < fb.height) 1186 while (j < fb.height)
1161 { 1187 {