Tue, 22 Jan 2002 09:42:42 +0000
*** empty log message ***
Makefile | file | annotate | diff | revisions | |
TODO | file | annotate | diff | revisions | |
bitblt.c | file | annotate | diff | revisions | |
bitblt.h | file | annotate | diff | revisions | |
bitblt_test.c | file | annotate | diff | revisions | |
t2p.c | file | annotate | diff | revisions | |
tumble.c | file | annotate | diff | revisions |
1.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a Makefile 1.2 --- a/Makefile Wed Jan 02 16:39:39 2002 +0000 1.3 +++ b/Makefile Tue Jan 22 09:42:42 2002 +0000 1.4 @@ -1,6 +1,6 @@ 1.5 # tiff2pdf: build a PDF file out of one or more TIFF Class F Group 4 files 1.6 # Makefile 1.7 -# $Id: Makefile,v 1.7 2001/12/30 23:24:50 eric Exp $ 1.8 +# $Id: Makefile,v 1.8 2002/01/22 01:41:12 eric Exp $ 1.9 # Copyright 2001 Eric Smith <eric@brouhaha.com> 1.10 # 1.11 # This program is free software; you can redistribute it and/or modify 1.12 @@ -34,7 +34,7 @@ 1.13 AUTO_HDRS = parser.tab.h 1.14 AUTO_MISC = parser.output 1.15 1.16 -tiff2pdf: tiff2pdf.o scanner.o semantics.o parser.tab.o 1.17 +tiff2pdf: tiff2pdf.o scanner.o semantics.o parser.tab.o bitblt.o 1.18 1.19 bitblt_test: bitblt_test.o bitblt.o 1.20
2.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a TODO 2.2 --- a/TODO Wed Jan 02 16:39:39 2002 +0000 2.3 +++ b/TODO Tue Jan 22 09:42:42 2002 +0000 2.4 @@ -1,5 +1,5 @@ 2.5 tiff2pdf TODO list 2.6 -$Id: TODO,v 1.4 2002/01/02 05:49:42 eric Exp $ 2.7 +$Id: TODO,v 1.5 2002/01/22 01:40:59 eric Exp $ 2.8 2.9 No particular order. Page numbers refer to _Portable Document Format 2.10 Reference Manual_ by Adobe Systems Incorporated, Addison-Wesley, 1993. 2.11 @@ -7,6 +7,7 @@ 2.12 ----------------------------------------------------------------------------- 2.13 * bitblt library: 2.14 * optimize 2.15 + * replace inner loops in flip_h and flip_v with Duff's Device 2.16 * check for endian problems 2.17 2.18 * crop
3.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a bitblt.c 3.2 --- a/bitblt.c Wed Jan 02 16:39:39 2002 +0000 3.3 +++ b/bitblt.c Tue Jan 22 09:42:42 2002 +0000 3.4 @@ -6,7 +6,7 @@ 3.5 #include "bitblt.h" 3.6 3.7 3.8 -#define CALC_ROWBYTES(width) (((width) - 1) / 8 + 1) 3.9 +#define DIV_ROUND_UP(count,pow2) (((count) - 1) / (pow2) + 1) 3.10 3.11 3.12 static const u8 bit_reverse_byte [0x100] = 3.13 @@ -45,8 +45,16 @@ 3.14 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff 3.15 }; 3.16 3.17 +static word_type bit_reverse_word (word_type d) 3.18 +{ 3.19 + return (bit_reverse_byte [d >> 24] | 3.20 + (bit_reverse_byte [(d >> 16) & 0xff] << 8) | 3.21 + (bit_reverse_byte [(d >> 8) & 0xff] << 16) | 3.22 + (bit_reverse_byte [d & 0xff] << 24)); 3.23 +} 3.24 3.25 -static u8 *temp_buffer; 3.26 + 3.27 +static u32 *temp_buffer; 3.28 static u32 temp_buffer_size; 3.29 3.30 static void realloc_temp_buffer (u32 size) 3.31 @@ -63,12 +71,12 @@ 3.32 } 3.33 3.34 3.35 -static inline u8 pixel_mask (x) 3.36 +static inline word_type pixel_mask (x) 3.37 { 3.38 #ifdef LSB_LEFT 3.39 return (1 << x); 3.40 #else 3.41 - return (1 << (7 - x)); 3.42 + return (1 << ((BITS_PER_WORD - 1) - x)); 3.43 #endif 3.44 }; 3.45 3.46 @@ -85,8 +93,8 @@ 3.47 if (! bitmap) 3.48 return (NULL); 3.49 bitmap->rect = * rect; 3.50 - bitmap->rowbytes = CALC_ROWBYTES (width); 3.51 - bitmap->bits = calloc (height * bitmap->rowbytes, 1); 3.52 + bitmap->row_words = DIV_ROUND_UP (width, BITS_PER_WORD); 3.53 + bitmap->bits = calloc (1, height * bitmap->row_words * sizeof (word_type)); 3.54 if (! bitmap->bits) 3.55 { 3.56 free (bitmap); 3.57 @@ -103,33 +111,33 @@ 3.58 3.59 boolean get_pixel (Bitmap *bitmap, Point coord) 3.60 { 3.61 - u8 *p; 3.62 + word_type *p; 3.63 if ((coord.x < bitmap->rect.min.x) || 3.64 (coord.x >= bitmap->rect.max.x) || 3.65 (coord.y < bitmap->rect.min.y) || 3.66 (coord.y >= bitmap->rect.max.y)) 3.67 return (0); 3.68 p = bitmap->bits + 3.69 - (coord.y - bitmap->rect.min.y) * bitmap->rowbytes + 3.70 - (coord.x - bitmap->rect.min.x) / 8; 3.71 - return ((*p & pixel_mask (coord.x & 7)) != 0); 3.72 + (coord.y - bitmap->rect.min.y) * bitmap->row_words + 3.73 + (coord.x - bitmap->rect.min.x) / BITS_PER_WORD; 3.74 + return ((*p & pixel_mask (coord.x & (BITS_PER_WORD - 1))) != 0); 3.75 } 3.76 3.77 void set_pixel (Bitmap *bitmap, Point coord, boolean value) 3.78 { 3.79 - u8 *p; 3.80 + word_type *p; 3.81 if ((coord.x < bitmap->rect.min.x) || 3.82 (coord.x >= bitmap->rect.max.x) || 3.83 (coord.y < bitmap->rect.min.y) || 3.84 (coord.y >= bitmap->rect.max.y)) 3.85 return; 3.86 p = bitmap->bits + 3.87 - (coord.y - bitmap->rect.min.y) * bitmap->rowbytes + 3.88 - (coord.x - bitmap->rect.min.x) / 8; 3.89 + (coord.y - bitmap->rect.min.y) * bitmap->row_words + 3.90 + (coord.x - bitmap->rect.min.x) / BITS_PER_WORD; 3.91 if (value) 3.92 - *p |= pixel_mask (coord.x & 7); 3.93 + *p |= pixel_mask (coord.x & (BITS_PER_WORD - 1)); 3.94 else 3.95 - *p &= (0xff ^ pixel_mask (coord.x & 7)); 3.96 + *p &= ~pixel_mask (coord.x & (BITS_PER_WORD - 1)); 3.97 } 3.98 3.99 3.100 @@ -166,11 +174,210 @@ 3.101 } 3.102 3.103 3.104 +#if 0 3.105 +static void blt_background (Bitmap *dest_bitmap, 3.106 + Rect *dest_rect) 3.107 +{ 3.108 + s32 y; 3.109 + word_type *rp; 3.110 + 3.111 + /* This function requires a non-null dest rect */ 3.112 + assert (dest_rect->min.x < dest_rect->max.x); 3.113 + assert (dest_rect->min.y < dest_rect->max.y); 3.114 + 3.115 + /* and that the rows of the dest rect lie entirely within the dest bitmap */ 3.116 + assert (dest_rect->min.y >= dest_bitmap->rect->min.y); 3.117 + assert (dest_rect->max.y <= dest_bitmap->rect->max.y); 3.118 + 3.119 + /* clip the x axis of the dest_rect to the bounds of the dest bitmap */ 3.120 + if (dest_rect->min.x < dest_bitmap->rect.min.x) 3.121 + dest_rect->min.x = dest_bitmap->rect.min.x; 3.122 + if (dest_rect->max.x > dest_bitmap->rect.max.x) 3.123 + dest_rect->max.x = dest_bitmap->rect.max.x; 3.124 + 3.125 + rp = ???; 3.126 + for (y = 0; y < rect_height (dest_rect); y++) 3.127 + { 3.128 + ???; 3.129 + rp += dest_bitmap->row_words; 3.130 + } 3.131 +} 3.132 + 3.133 + 3.134 +static void blt (Bitmap *src_bitmap, 3.135 + Rect *src_rect, 3.136 + Bitmap *dest_bitmap, 3.137 + Rect *dest_rect) 3.138 +{ 3.139 + s32 y; 3.140 + word_type *rp; 3.141 + 3.142 + /* This function requires a non-null src rect */ 3.143 + assert (dest_rect->min.x < dest_rect->max.x); 3.144 + assert (dest_rect->min.y < dest_rect->max.y); 3.145 + 3.146 + /* and a non-null dest rect */ 3.147 + assert (dest_rect->min.x < dest_rect->max.x); 3.148 + assert (dest_rect->min.y < dest_rect->max.y); 3.149 + 3.150 + /* and that the widths and heights of the rects match */ 3.151 + assert (rect_width (src_rect) == rect_width (dest_rect)); 3.152 + assert (rect_height (src_rect) == rect_height (dest_rect)); 3.153 + 3.154 + /* and that the rows of the src rect lie entirely within the src bitmap */ 3.155 + assert (dest_rect->min.y >= dest_bitmap->rect->min.y); 3.156 + assert (dest_rect->max.y <= dest_bitmap->rect->max.y); 3.157 + 3.158 + /* and that the rows of the dest rect lie entirely within the dest bitmap */ 3.159 + assert (dest_rect->min.y >= dest_bitmap->rect->min.y); 3.160 + assert (dest_rect->max.y <= dest_bitmap->rect->max.y); 3.161 + 3.162 + /* clip the x axis of the dest_rect to the bounds of the dest bitmap, 3.163 + and adjust the src_rect to match */ 3.164 + if (dest_rect->min.x < dest_bitmap->rect.min.x) 3.165 + { 3.166 + src_rect->min.x += ???; 3.167 + dest_rect->min.x = dest_bitmap->rect.min.x; 3.168 + } 3.169 + if (dest_rect->max.x > dest_bitmap->rect.max.x) 3.170 + { 3.171 + dest_rect->max.x = dest_bitmap->rect.max.x; 3.172 + } 3.173 + 3.174 + rp = ???; 3.175 + for (y = 0; y < rect_height (dest_rect); y++) 3.176 + { 3.177 + ???; 3.178 + rp += dest_bitmap->row_words; 3.179 + } 3.180 +} 3.181 + 3.182 + 3.183 Bitmap *bitblt (Bitmap *src_bitmap, 3.184 Rect *src_rect, 3.185 Bitmap *dest_bitmap, 3.186 Point *dest_min, 3.187 - int tfn) 3.188 + int tfn, 3.189 + int background) 3.190 +{ 3.191 + Rect sr, dr; /* src and dest rects, clipped to visible portion of 3.192 + dest rect */ 3.193 + u32 drw, drh; /* dest rect width, height - gets adjusted */ 3.194 + Point src_point, dest_point; 3.195 + 3.196 + { 3.197 + sr = * src_rect; 3.198 + 3.199 + u32 srw = rect_width (& sr); 3.200 + u32 srh = rect_height (& sr); 3.201 + 3.202 + if ((srw < 0) || (srh < 0)) 3.203 + goto done; /* the source rect is empty! */ 3.204 + 3.205 + dr.min = * dest_min; 3.206 + dr.max.x = dr.min.x + srw; 3.207 + dr.max.y = dr.min.y + srh; 3.208 + } 3.209 + 3.210 + if (! dest_bitmap) 3.211 + { 3.212 + dest_bitmap = create_bitmap (& dr); 3.213 + if (! dest_bitmap) 3.214 + return (NULL); 3.215 + } 3.216 + 3.217 + if ((dr.min.x >= dest_bitmap->rect.max.x) || 3.218 + (dr.min.y >= dest_bitmap->rect.max.y)) 3.219 + goto done; /* the dest rect isn't even in the dest bitmap! */ 3.220 + 3.221 + /* crop dest rect to dest bitmap */ 3.222 + 3.223 + delta = dest_bitmap->rect.min.x - dr.min.x; 3.224 + if (delta > 0) 3.225 + { 3.226 + sr.min.x += delta; 3.227 + dr.min.x += delta; 3.228 + } 3.229 + 3.230 + delta = dest_bitmap->rect.min.y - dr.min.y; 3.231 + if (delta > 0) 3.232 + { 3.233 + sr.min.y += delta; 3.234 + dr.min.y += delta; 3.235 + } 3.236 + 3.237 + delta = dr.max.x - dest_bitmap->rect.max.x; 3.238 + if (delta > 0) 3.239 + { 3.240 + sr.max.x -= delta; 3.241 + dr.max.x -= delta; 3.242 + } 3.243 + 3.244 + delta = dr.max.y - dest_bitmap->rect.max.y; 3.245 + if (delta > 0) 3.246 + { 3.247 + sr.max.x -= delta; 3.248 + dr.max.x -= delta; 3.249 + } 3.250 + 3.251 + drw = rect_width (& dr); 3.252 + drh = rect_height (& dh); 3.253 + 3.254 + /* if the source rect min y is >= the source bitmap max y, 3.255 + we transfer background color to the entire dest rect */ 3.256 + if (sr.min.y >= src->rect.max.y) 3.257 + { 3.258 + blt_background (dest_bitmap, & dr); 3.259 + goto done; 3.260 + } 3.261 + 3.262 + /* if the source rect min y is less than the source bitmap min y, 3.263 + we need to transfer some backgound color to the top part of the dest 3.264 + rect */ 3.265 + if (sr.min.y < src->rect.min.y) 3.266 + { 3.267 + Rect dr2; 3.268 + uint32 bg_height; 3.269 + 3.270 + bg_height = src->rect.min.y - sr.min.y; 3.271 + if (bg_height > sh) 3.272 + bg_height = sh; 3.273 + 3.274 + dr2 = dr; 3.275 + dr2.max.y = dr2.min.y + bg_height; 3.276 + 3.277 + blt_background (dest_bitmap, & dr2); 3.278 + 3.279 + /* now reduce the rect height by the number of lines of background 3.280 + color */ 3.281 + sr.min.y += bg_height; 3.282 + dr.min.y += bg_height; 3.283 + sh -= bg_height; 3.284 + dh -= bg_height; 3.285 + 3.286 + if (sr.min.y == sr.max.y) 3.287 + goto done; 3.288 + } 3.289 + 3.290 + /* now blt the available rows of the source rect */ 3.291 + 3.292 + /* now transfer the background color to any remaining rows of the 3.293 + dest rect */ 3.294 + if (??? ) 3.295 + { 3.296 + blt_background (dest_bitmap, & dr); 3.297 + } 3.298 + 3.299 + done: 3.300 + return (dest_bitmap); 3.301 +} 3.302 +#else 3.303 +Bitmap *bitblt (Bitmap *src_bitmap, 3.304 + Rect *src_rect, 3.305 + Bitmap *dest_bitmap, 3.306 + Point *dest_min, 3.307 + int tfn, 3.308 + int background) 3.309 { 3.310 Point src_point, dest_point; 3.311 3.312 @@ -206,73 +413,77 @@ 3.313 } 3.314 return (dest_bitmap); 3.315 } 3.316 +#endif 3.317 3.318 3.319 /* in-place transformations */ 3.320 void flip_h (Bitmap *src) 3.321 { 3.322 - u8 *rp; /* row pointer */ 3.323 - u8 *p1; /* work src ptr */ 3.324 - u8 *p2; /* work dest ptr */ 3.325 - u16 d; 3.326 + word_type *rp; /* row pointer */ 3.327 + word_type *p1; /* work src ptr */ 3.328 + word_type *p2; /* work dest ptr */ 3.329 s32 y; 3.330 - int shift; 3.331 + int shift1, shift2; 3.332 3.333 - realloc_temp_buffer (src->rowbytes + 1); 3.334 + realloc_temp_buffer ((src->row_words + 1) * sizeof (word_type)); 3.335 3.336 rp = src->bits; 3.337 if ((rect_width (& src->rect) & 7) == 0) 3.338 { 3.339 for (y = src->rect.min.y; y < src->rect.max.y; y++) 3.340 { 3.341 - memcpy (temp_buffer, rp, src->rowbytes); 3.342 - p1 = temp_buffer + src->rowbytes - 1; 3.343 + memcpy (temp_buffer, rp, src->row_words * sizeof (word_type)); 3.344 + p1 = temp_buffer + src->row_words; 3.345 p2 = rp; 3.346 3.347 while (p1 >= temp_buffer) 3.348 - *(p2++) = bit_reverse_byte [*(p1--)]; 3.349 + *(p2++) = bit_reverse_word (*(p1--)); 3.350 3.351 - rp += src->rowbytes; 3.352 + rp += src->row_words; 3.353 } 3.354 return; 3.355 } 3.356 3.357 temp_buffer [0] = 0; 3.358 - shift = 8 - (rect_width (& src->rect) & 7); 3.359 + shift1 = rect_width (& src->rect) & (BITS_PER_WORD - 1); 3.360 + shift2 = BITS_PER_WORD - shift1; 3.361 3.362 for (y = src->rect.min.y; y < src->rect.max.y; y++) 3.363 { 3.364 - memcpy (temp_buffer + 1, rp, src->rowbytes); 3.365 - p1 = temp_buffer + src->rowbytes; 3.366 + word_type d1, d2; 3.367 + 3.368 + memcpy (temp_buffer + 1, rp, src->row_words * sizeof (word_type)); 3.369 + p1 = temp_buffer + src->row_words; 3.370 p2 = rp; 3.371 3.372 - d = *(p1--); 3.373 + d2 = *(p1--); 3.374 3.375 while (p1 >= temp_buffer) 3.376 { 3.377 - d = (d >> 8) | ((*(p1--)) << 8); 3.378 - *(p2++) = bit_reverse_byte [(d >> shift) & 0xff]; 3.379 + d1 = *(p1--); 3.380 + *(p2++) = bit_reverse_word ((d1 << shift1) | (d2 >> shift2)); 3.381 + d2 = d1; 3.382 } 3.383 3.384 - rp += src->rowbytes; 3.385 + rp += src->row_words; 3.386 } 3.387 } 3.388 3.389 void flip_v (Bitmap *src) 3.390 { 3.391 - u8 *p1, *p2; 3.392 + word_type *p1, *p2; 3.393 3.394 - realloc_temp_buffer (src->rowbytes); 3.395 + realloc_temp_buffer (src->row_words * sizeof (word_type)); 3.396 3.397 p1 = src->bits; 3.398 - p2 = src->bits + src->rowbytes * (rect_height (& src->rect) - 1); 3.399 + p2 = src->bits + src->row_words * (rect_height (& src->rect) - 1); 3.400 while (p1 < p2) 3.401 { 3.402 - memcpy (temp_buffer, p1, src->rowbytes); 3.403 - memcpy (p1, p2, src->rowbytes); 3.404 - memcpy (p2, temp_buffer, src->rowbytes); 3.405 - p1 += src->rowbytes; 3.406 - p2 -= src->rowbytes; 3.407 + memcpy (temp_buffer, p1, src->row_words * sizeof (word_type)); 3.408 + memcpy (p1, p2, src->row_words * sizeof (word_type)); 3.409 + memcpy (p2, temp_buffer, src->row_words * sizeof (word_type)); 3.410 + p1 += src->row_words; 3.411 + p2 -= src->row_words; 3.412 } 3.413 } 3.414 3.415 @@ -285,10 +496,10 @@ 3.416 /* "in-place" transformations - will allocate new memory and free old */ 3.417 void transpose (Bitmap *src) 3.418 { 3.419 - u32 new_rowbytes = CALC_ROWBYTES (rect_height (& src->rect)); 3.420 - u8 *new_bits; 3.421 + u32 new_row_words = DIV_ROUND_UP (rect_height (& src->rect), 32); 3.422 + word_type *new_bits; 3.423 3.424 - new_bits = calloc (1, new_rowbytes * rect_width (& src->rect)); 3.425 + new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_type)); 3.426 3.427 /* $$$ more code needed here */ 3.428 }
4.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a bitblt.h 4.2 --- a/bitblt.h Wed Jan 02 16:39:39 2002 +0000 4.3 +++ b/bitblt.h Tue Jan 22 09:42:42 2002 +0000 4.4 @@ -20,11 +20,18 @@ 4.5 return (r->max.y - r->min.y); 4.6 } 4.7 4.8 +/* 4.9 + * Despite the following two definitions, there are still some places 4.10 + * in the code that depend on words having 32 bits. 4.11 + */ 4.12 +#define BITS_PER_WORD 32 4.13 +typedef u32 word_type; 4.14 + 4.15 typedef struct Bitmap 4.16 { 4.17 - u8 *bits; 4.18 + word_type *bits; 4.19 Rect rect; 4.20 - u32 rowbytes; 4.21 + u32 row_words; 4.22 } Bitmap; 4.23 4.24 4.25 @@ -45,7 +52,8 @@ 4.26 Rect *src_rect, 4.27 Bitmap *dest_bitmap, 4.28 Point *dest_min, 4.29 - int tfn); 4.30 + int tfn, 4.31 + int background); 4.32 4.33 4.34 /* in-place transformations */
5.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a bitblt_test.c 5.2 --- a/bitblt_test.c Wed Jan 02 16:39:39 2002 +0000 5.3 +++ b/bitblt_test.c Tue Jan 22 09:42:42 2002 +0000 5.4 @@ -1,4 +1,5 @@ 5.5 #include <stdio.h> 5.6 +#include <stdlib.h> 5.7 5.8 #include "type.h" 5.9 #include "bitblt.h" 5.10 @@ -24,8 +25,9 @@ 5.11 { 5.12 Bitmap *b; 5.13 Point p; 5.14 + Rect r = {{ 0, 0 }, { WIDTH, HEIGHT }}; 5.15 5.16 - b = create_bitmap (WIDTH, HEIGHT); 5.17 + b = create_bitmap (& r); 5.18 if (! b) 5.19 return (NULL); 5.20 5.21 @@ -39,10 +41,10 @@ 5.22 void print_bitmap (FILE *o, Bitmap *b) 5.23 { 5.24 Point p; 5.25 - printf ("rowbytes: %d\n", b->rowbytes); 5.26 - for (p.y = 0; p.y < b->height; p.y++) 5.27 + printf ("row_words: %d\n", b->row_words); 5.28 + for (p.y = b->rect.min.y; p.y < b->rect.max.y; p.y++) 5.29 { 5.30 - for (p.x = 0; p.x < b->width; p.x++) 5.31 + for (p.x = b->rect.min.x; p.x < b->rect.max.x; p.x++) 5.32 fputc (".X" [get_pixel (b, p)], o); 5.33 fprintf (o, "\n"); 5.34 } 5.35 @@ -64,18 +66,19 @@ 5.36 } 5.37 5.38 print_bitmap (stdout, b); 5.39 + printf ("\n"); 5.40 5.41 + flip_v (b); 5.42 + 5.43 + print_bitmap (stdout, b); 5.44 + printf ("\n"); 5.45 + 5.46 + flip_h (b); 5.47 + 5.48 + print_bitmap (stdout, b); 5.49 printf ("\n"); 5.50 5.51 #if 0 5.52 - b2 = create_bitmap (b->height, b->width); 5.53 - if (! b2) 5.54 - { 5.55 - fprintf (stderr, "create_bitmap failed\n"); 5.56 - exit (2); 5.57 - } 5.58 -#endif 5.59 - 5.60 r.upper_left.x = r.upper_left.y = 0; 5.61 r.lower_right.x = b->width; 5.62 r.lower_right.y = b->height; 5.63 @@ -92,6 +95,7 @@ 5.64 } 5.65 5.66 print_bitmap (stdout, b2); 5.67 +#endif 5.68 5.69 exit (0); 5.70 }
6.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a t2p.c 6.2 --- a/t2p.c Wed Jan 02 16:39:39 2002 +0000 6.3 +++ b/t2p.c Tue Jan 22 09:42:42 2002 +0000 6.4 @@ -5,7 +5,7 @@ 6.5 * encoding. 6.6 * 6.7 * Main program 6.8 - * $Id: t2p.c,v 1.14 2002/01/02 08:39:39 eric Exp $ 6.9 + * $Id: t2p.c,v 1.15 2002/01/22 01:42:42 eric Exp $ 6.10 * Copyright 2001 Eric Smith <eric@brouhaha.com> 6.11 * 6.12 * This program is free software; you can redistribute it and/or modify 6.13 @@ -200,7 +200,7 @@ 6.14 dest_min.x = 0; 6.15 dest_min.y = 0; 6.16 6.17 - dest = bitblt (src, & src_rect, NULL, & dest_min, TF_SRC); 6.18 + dest = bitblt (src, & src_rect, NULL, & dest_min, TF_SRC, 0); 6.19 free_bitmap (src); 6.20 return (dest); 6.21 } 6.22 @@ -244,8 +244,6 @@ 6.23 float x_resolution, y_resolution; 6.24 float dest_x_resolution, dest_y_resolution; 6.25 6.26 - int scanline_size; 6.27 - 6.28 int width_points, height_points; /* really 1/72 inch units rather than 6.29 points */ 6.30 6.31 @@ -358,8 +356,6 @@ 6.32 dest_y_resolution = y_resolution; 6.33 } 6.34 6.35 - scanline_size = TIFFScanlineSize (in); 6.36 - 6.37 rect.min.x = 0; 6.38 rect.min.y = 0; 6.39 rect.max.x = image_width; 6.40 @@ -373,22 +369,9 @@ 6.41 goto fail; 6.42 } 6.43 6.44 - if (bitmap->rowbytes != scanline_size) 6.45 - { 6.46 - printf ("image_width %d\n", image_width); 6.47 - printf ("rowbytes %d\n", bitmap->rowbytes); 6.48 - printf ("TIFFScanlineSize %d\n", scanline_size); 6.49 - } 6.50 - 6.51 for (row = 0; row < image_length; row++) 6.52 - TIFFReadScanline (in, 6.53 - bitmap->bits + row * bitmap->rowbytes, 6.54 - row, 6.55 - 0); 6.56 - 6.57 - for (row = 0; row < dest_image_length; row++) 6.58 if (1 != TIFFReadScanline (in, 6.59 - bitmap->bits + row * bitmap->rowbytes, 6.60 + bitmap->bits + row * bitmap->row_words, 6.61 row, 6.62 0)) 6.63 { 6.64 @@ -435,7 +418,7 @@ 6.65 6.66 for (row = 0; row < rect_height (& bitmap->rect); row++) 6.67 if (1 != TIFFWriteScanline (tiff_temp, 6.68 - bitmap->bits + row * bitmap->rowbytes, 6.69 + bitmap->bits + row * bitmap->row_words, 6.70 row, 6.71 0)) 6.72 {
7.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a tumble.c 7.2 --- a/tumble.c Wed Jan 02 16:39:39 2002 +0000 7.3 +++ b/tumble.c Tue Jan 22 09:42:42 2002 +0000 7.4 @@ -5,7 +5,7 @@ 7.5 * encoding. 7.6 * 7.7 * Main program 7.8 - * $Id: tumble.c,v 1.14 2002/01/02 08:39:39 eric Exp $ 7.9 + * $Id: tumble.c,v 1.15 2002/01/22 01:42:42 eric Exp $ 7.10 * Copyright 2001 Eric Smith <eric@brouhaha.com> 7.11 * 7.12 * This program is free software; you can redistribute it and/or modify 7.13 @@ -200,7 +200,7 @@ 7.14 dest_min.x = 0; 7.15 dest_min.y = 0; 7.16 7.17 - dest = bitblt (src, & src_rect, NULL, & dest_min, TF_SRC); 7.18 + dest = bitblt (src, & src_rect, NULL, & dest_min, TF_SRC, 0); 7.19 free_bitmap (src); 7.20 return (dest); 7.21 } 7.22 @@ -244,8 +244,6 @@ 7.23 float x_resolution, y_resolution; 7.24 float dest_x_resolution, dest_y_resolution; 7.25 7.26 - int scanline_size; 7.27 - 7.28 int width_points, height_points; /* really 1/72 inch units rather than 7.29 points */ 7.30 7.31 @@ -358,8 +356,6 @@ 7.32 dest_y_resolution = y_resolution; 7.33 } 7.34 7.35 - scanline_size = TIFFScanlineSize (in); 7.36 - 7.37 rect.min.x = 0; 7.38 rect.min.y = 0; 7.39 rect.max.x = image_width; 7.40 @@ -373,22 +369,9 @@ 7.41 goto fail; 7.42 } 7.43 7.44 - if (bitmap->rowbytes != scanline_size) 7.45 - { 7.46 - printf ("image_width %d\n", image_width); 7.47 - printf ("rowbytes %d\n", bitmap->rowbytes); 7.48 - printf ("TIFFScanlineSize %d\n", scanline_size); 7.49 - } 7.50 - 7.51 for (row = 0; row < image_length; row++) 7.52 - TIFFReadScanline (in, 7.53 - bitmap->bits + row * bitmap->rowbytes, 7.54 - row, 7.55 - 0); 7.56 - 7.57 - for (row = 0; row < dest_image_length; row++) 7.58 if (1 != TIFFReadScanline (in, 7.59 - bitmap->bits + row * bitmap->rowbytes, 7.60 + bitmap->bits + row * bitmap->row_words, 7.61 row, 7.62 0)) 7.63 { 7.64 @@ -435,7 +418,7 @@ 7.65 7.66 for (row = 0; row < rect_height (& bitmap->rect); row++) 7.67 if (1 != TIFFWriteScanline (tiff_temp, 7.68 - bitmap->bits + row * bitmap->rowbytes, 7.69 + bitmap->bits + row * bitmap->row_words, 7.70 row, 7.71 0)) 7.72 {