X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/13111b2ac81e694d6b69822dff61838ae66052b2..f5ba273ecd799f652736ce2bc830283787302a56:/src/common/imagtiff.cpp diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index f60d864a40..2bbfa1071a 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -31,7 +31,6 @@ extern "C" { #include "tiff.h" #include "tiffio.h" - #include "tiffiop.h" } #include "wx/filefn.h" #include "wx/wfstream.h" @@ -113,9 +112,6 @@ TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode) _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); - if (tif) - tif->tif_fd = (int) &stream; - return tif; } @@ -163,7 +159,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos return FALSE; } - image->Create( w, h ); + image->Create( (int)w, (int)h ); if (!image->Ok()) { if (verbose) @@ -188,13 +184,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 < w; j++) { - unsigned char alpha = (unsigned char)(raster[pos] >> 24); + unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]); if (alpha < 127) { hasmask = TRUE; @@ -207,15 +204,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 );