X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/479cd5de40ca8029c79e780170fa7c0af7ec0297..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/common/imagtiff.cpp diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index a3b07a77d4..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; } @@ -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 );