1.1 diff -r 9b35b78d4c91 -r 663da96ad2bc bitblt.c 1.2 --- a/bitblt.c Wed Mar 12 10:58:33 2003 +0000 1.3 +++ b/bitblt.c Wed Mar 12 10:59:09 2003 +0000 1.4 @@ -4,7 +4,7 @@ 1.5 * will be compressed using ITU-T T.6 (G4) fax encoding. 1.6 * 1.7 * bitblt routines 1.8 - * $Id: bitblt.c,v 1.14 2003/03/11 22:02:46 eric Exp $ 1.9 + * $Id: bitblt.c,v 1.15 2003/03/12 02:59:09 eric Exp $ 1.10 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 1.11 * 1.12 * This program is free software; you can redistribute it and/or modify 1.13 @@ -49,7 +49,7 @@ 1.14 } 1.15 1.16 1.17 -static word_type bit_reverse_word (word_type d) 1.18 +static word_t bit_reverse_word (word_t d) 1.19 { 1.20 return (bit_reverse_byte [d >> 24] | 1.21 (bit_reverse_byte [(d >> 16) & 0xff] << 8) | 1.22 @@ -58,8 +58,8 @@ 1.23 } 1.24 1.25 1.26 -static word_type *temp_buffer; 1.27 -static word_type temp_buffer_size; 1.28 +static word_t *temp_buffer; 1.29 +static word_t temp_buffer_size; 1.30 1.31 static void realloc_temp_buffer (uint32_t size) 1.32 { 1.33 @@ -75,10 +75,10 @@ 1.34 } 1.35 1.36 1.37 -static inline word_type pixel_mask (int x) 1.38 +static inline word_t pixel_mask (int x) 1.39 { 1.40 #if defined (MIXED_ENDIAN) /* disgusting hack for mixed-endian */ 1.41 - word_type m; 1.42 + word_t m; 1.43 m = 0x80 >> (x & 7); 1.44 m <<= (x & 24); 1.45 return (m); 1.46 @@ -91,9 +91,9 @@ 1.47 1.48 1.49 /* mask for range of bits left..right, inclusive */ 1.50 -static inline word_type pixel_range_mask (int left, int right) 1.51 +static inline word_t pixel_range_mask (int left, int right) 1.52 { 1.53 - word_type m1, m2, val; 1.54 + word_t m1, m2, val; 1.55 1.56 /* $$$ one of these cases is wrong! */ 1.57 #if defined (LSB_RIGHT) 1.58 @@ -124,7 +124,7 @@ 1.59 return (NULL); 1.60 bitmap->rect = * rect; 1.61 bitmap->row_words = DIV_ROUND_UP (width, BITS_PER_WORD); 1.62 - bitmap->bits = calloc (1, height * bitmap->row_words * sizeof (word_type)); 1.63 + bitmap->bits = calloc (1, height * bitmap->row_words * sizeof (word_t)); 1.64 if (! bitmap->bits) 1.65 { 1.66 free (bitmap); 1.67 @@ -141,7 +141,7 @@ 1.68 1.69 bool get_pixel (Bitmap *bitmap, Point coord) 1.70 { 1.71 - word_type *p; 1.72 + word_t *p; 1.73 int w,b; 1.74 1.75 if ((coord.x < bitmap->rect.min.x) || 1.76 @@ -159,7 +159,7 @@ 1.77 1.78 void set_pixel (Bitmap *bitmap, Point coord, bool value) 1.79 { 1.80 - word_type *p; 1.81 + word_t *p; 1.82 int w,b; 1.83 1.84 if ((coord.x < bitmap->rect.min.x) || 1.85 @@ -216,10 +216,10 @@ 1.86 Rect dest_rect) 1.87 { 1.88 uint32_t y; 1.89 - word_type *rp; 1.90 + word_t *rp; 1.91 uint32_t left_bit, left_word; 1.92 uint32_t right_bit, right_word; 1.93 - word_type left_mask, right_mask; 1.94 + word_t left_mask, right_mask; 1.95 int32_t word_count; 1.96 1.97 /* This function requires a non-null dest rect */ 1.98 @@ -272,7 +272,7 @@ 1.99 1.100 for (y = 0; y < rect_height (& dest_rect); y++) 1.101 { 1.102 - word_type *wp = rp; 1.103 + word_t *wp = rp; 1.104 1.105 /* partial word at left, if any */ 1.106 if (left_mask) 1.107 @@ -316,7 +316,7 @@ 1.108 Rect *dest_rect) 1.109 { 1.110 int32_t y; 1.111 - word_type *rp; 1.112 + word_t *rp; 1.113 1.114 /* This function requires a non-null src rect */ 1.115 assert (dest_rect->min.x < dest_rect->max.x); 1.116 @@ -628,20 +628,20 @@ 1.117 /* in-place transformations */ 1.118 void flip_h (Bitmap *src) 1.119 { 1.120 - word_type *rp; /* row pointer */ 1.121 - word_type *p1; /* work src ptr */ 1.122 - word_type *p2; /* work dest ptr */ 1.123 + word_t *rp; /* row pointer */ 1.124 + word_t *p1; /* work src ptr */ 1.125 + word_t *p2; /* work dest ptr */ 1.126 int32_t y; 1.127 int shift1, shift2; 1.128 1.129 - realloc_temp_buffer ((src->row_words + 1) * sizeof (word_type)); 1.130 + realloc_temp_buffer ((src->row_words + 1) * sizeof (word_t)); 1.131 1.132 rp = src->bits; 1.133 if ((rect_width (& src->rect) & 7) == 0) 1.134 { 1.135 for (y = src->rect.min.y; y < src->rect.max.y; y++) 1.136 { 1.137 - memcpy (temp_buffer, rp, src->row_words * sizeof (word_type)); 1.138 + memcpy (temp_buffer, rp, src->row_words * sizeof (word_t)); 1.139 p1 = temp_buffer + src->row_words; 1.140 p2 = rp; 1.141 1.142 @@ -659,9 +659,9 @@ 1.143 1.144 for (y = src->rect.min.y; y < src->rect.max.y; y++) 1.145 { 1.146 - word_type d1, d2; 1.147 + word_t d1, d2; 1.148 1.149 - memcpy (temp_buffer + 1, rp, src->row_words * sizeof (word_type)); 1.150 + memcpy (temp_buffer + 1, rp, src->row_words * sizeof (word_t)); 1.151 p1 = temp_buffer + src->row_words; 1.152 p2 = rp; 1.153 1.154 @@ -680,17 +680,17 @@ 1.155 1.156 void flip_v (Bitmap *src) 1.157 { 1.158 - word_type *p1, *p2; 1.159 + word_t *p1, *p2; 1.160 1.161 - realloc_temp_buffer (src->row_words * sizeof (word_type)); 1.162 + realloc_temp_buffer (src->row_words * sizeof (word_t)); 1.163 1.164 p1 = src->bits; 1.165 p2 = src->bits + src->row_words * (rect_height (& src->rect) - 1); 1.166 while (p1 < p2) 1.167 { 1.168 - memcpy (temp_buffer, p1, src->row_words * sizeof (word_type)); 1.169 - memcpy (p1, p2, src->row_words * sizeof (word_type)); 1.170 - memcpy (p2, temp_buffer, src->row_words * sizeof (word_type)); 1.171 + memcpy (temp_buffer, p1, src->row_words * sizeof (word_t)); 1.172 + memcpy (p1, p2, src->row_words * sizeof (word_t)); 1.173 + memcpy (p2, temp_buffer, src->row_words * sizeof (word_t)); 1.174 p1 += src->row_words; 1.175 p2 -= src->row_words; 1.176 } 1.177 @@ -706,9 +706,9 @@ 1.178 void transpose (Bitmap *src) 1.179 { 1.180 uint32_t new_row_words = DIV_ROUND_UP (rect_height (& src->rect), 32); 1.181 - word_type *new_bits; 1.182 + word_t *new_bits; 1.183 1.184 - new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_type)); 1.185 + new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_t)); 1.186 1.187 /* $$$ more code needed here */ 1.188 }