From 5c5ab9ebc3a7dd441c9e3b25cb3daf8f733c374f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 14 Jan 2000 14:27:09 +0000 Subject: [PATCH] TIFF fix. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagtiff.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index a3b07a77d4..088dd14979 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -188,13 +188,14 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos bool hasmask = FALSE; unsigned char *ptr = image->GetData(); + ptr += w*3*(h-1); uint32 pos = 0; 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) { hasmask = TRUE; @@ -207,15 +208,16 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } else { - ptr[0] = (unsigned char)(raster[pos] >> 16); + ptr[0] = (unsigned char)TIFFGetR(raster[pos]); ptr++; - ptr[0] = (unsigned char)(raster[pos] >> 8); + ptr[0] = (unsigned char)TIFFGetG(raster[pos]); ptr++; - ptr[0] = (unsigned char)(raster[pos]); + ptr[0] = (unsigned char)TIFFGetB(raster[pos]); ptr++; } pos++; } + ptr -= 2*w*3; // subtract line we just added plus one line } _TIFFfree( raster ); -- 2.45.2