This commit is contained in:
Andrey Kiselev 2007-01-27 18:38:34 +00:00
parent 367a35efb3
commit 7fd8cdbe99

View File

@ -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 * 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? * Do we want to strip away alpha components?
*/ */
if( no_alpha ) if (no_alpha)
{ {
int pixel_count = width * height; int pixel_count = width * height;
unsigned char *src, *dst; uint32 *src = raster;
unsigned char *dst = (unsigned char *) raster;
src = (unsigned char *) raster; while (pixel_count > 0)
dst = (unsigned char *) raster;
while( pixel_count > 0 )
{ {
*(dst++) = *(src++); uint32 temp = *src++;
*(dst++) = *(src++); *(dst++) = TIFFGetR(temp);
*(dst++) = *(src++); *(dst++) = TIFFGetG(temp);
src++; *(dst++) = TIFFGetB(temp);
pixel_count--; pixel_count--;
} }
} }
/* Write out the result in strips */ /*
* Write out the result in strips
for( row = 0; row < height; row += rowsperstrip ) */
for (row = 0; row < height; row += rowsperstrip)
{ {
unsigned char * raster_strip; unsigned char * raster_strip;
int rows_to_write; int rows_to_write;
int bytes_per_pixel; int bytes_per_pixel;
if( no_alpha ) if (no_alpha)
{ {
raster_strip = ((unsigned char *) raster) + 3 * row * width; raster_strip = ((unsigned char *) raster) + 3 * row * width;
bytes_per_pixel = 3; bytes_per_pixel = 3;