TIFF fix.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-01-14 14:27:09 +00:00
parent 93759cda46
commit 5c5ab9ebc3

View File

@@ -188,13 +188,14 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
bool hasmask = FALSE; bool hasmask = FALSE;
unsigned char *ptr = image->GetData(); unsigned char *ptr = image->GetData();
ptr += w*3*(h-1);
uint32 pos = 0; uint32 pos = 0;
for (uint32 i = 0; i < h; i++) for (uint32 i = 0; i < h; i++)
{ {
for (uint32 j = 0; w < h; j++) for (uint32 j = 0; j < h; j++)
{ {
unsigned char alpha = (unsigned char)(raster[pos] >> 24); unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]);
if (alpha < 127) if (alpha < 127)
{ {
hasmask = TRUE; hasmask = TRUE;
@@ -207,15 +208,16 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
} }
else else
{ {
ptr[0] = (unsigned char)(raster[pos] >> 16); ptr[0] = (unsigned char)TIFFGetR(raster[pos]);
ptr++; ptr++;
ptr[0] = (unsigned char)(raster[pos] >> 8); ptr[0] = (unsigned char)TIFFGetG(raster[pos]);
ptr++; ptr++;
ptr[0] = (unsigned char)(raster[pos]); ptr[0] = (unsigned char)TIFFGetB(raster[pos]);
ptr++; ptr++;
} }
pos++; pos++;
} }
ptr -= 2*w*3; // subtract line we just added plus one line
} }
_TIFFfree( raster ); _TIFFfree( raster );