diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-01-27 18:38:34 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-01-27 18:38:34 +0000 |
commit | 7fd8cdbe997b9d18520cd6ed3258bdfbffaf40e1 (patch) | |
tree | 079e1dfbb23687e811246a1a149ca903bb4ecd37 /tools/tiff2rgba.c | |
parent | 367a35efb309d8dd3c8ee97cbc36b4e29f62c00c (diff) | |
download | libtiff-git-7fd8cdbe997b9d18520cd6ed3258bdfbffaf40e1.tar.gz |
Attempt to fix bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1149
Diffstat (limited to 'tools/tiff2rgba.c')
-rw-r--r-- | tools/tiff2rgba.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c index ef9d6f9e..9c64342b 100644 --- a/tools/tiff2rgba.c +++ b/tools/tiff2rgba.c @@ -1,4 +1,4 @@ -/* $Id: tiff2rgba.c,v 1.11 2004-11-03 00:28:24 fwarmerdam Exp $ */ +/* $Id: tiff2rgba.c,v 1.12 2007-01-27 18:38:34 dron Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -349,34 +349,34 @@ cvt_whole_image( TIFF *in, TIFF *out ) } /* - ** Do we want to strip away alpha components? - */ - if( no_alpha ) + * Do we want to strip away alpha components? + */ + if (no_alpha) { - int pixel_count = width * height; - unsigned char *src, *dst; + int pixel_count = width * height; + uint32 *src = raster; + unsigned char *dst = (unsigned char *) raster; - src = (unsigned char *) raster; - dst = (unsigned char *) raster; - while( pixel_count > 0 ) + while (pixel_count > 0) { - *(dst++) = *(src++); - *(dst++) = *(src++); - *(dst++) = *(src++); - src++; - pixel_count--; + uint32 temp = *src++; + *(dst++) = TIFFGetR(temp); + *(dst++) = TIFFGetG(temp); + *(dst++) = TIFFGetB(temp); + pixel_count--; } } - /* Write out the result in strips */ - - for( row = 0; row < height; row += rowsperstrip ) + /* + * Write out the result in strips + */ + for (row = 0; row < height; row += rowsperstrip) { unsigned char * raster_strip; int rows_to_write; int bytes_per_pixel; - if( no_alpha ) + if (no_alpha) { raster_strip = ((unsigned char *) raster) + 3 * row * width; bytes_per_pixel = 3; |