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