From 5d2be7cc55d83b6e5a7597add2fef248ab3c558f Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Sun, 28 Aug 2011 21:59:36 +0000 Subject: [PATCH] Read TIFF images from top to bottom instead of bottom to top. Use TIFFReadRGBAImageOriented with a parameter of ORIENTATION_TOPLEFT instead of using TIFFReadRGBAImage (which uses ORIENTATION_BOTTOMLEFT) to read images in a more logical order and simplify code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagtiff.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index a426c6a8b4..b643ff24e3 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -394,7 +394,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if ( hasAlpha ) image->SetAlpha(); - if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) + if (!TIFFReadRGBAImageOriented( tif, w, h, raster, ORIENTATION_TOPLEFT, 0 )) { if (verbose) { @@ -409,11 +409,8 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } unsigned char *ptr = image->GetData(); - ptr += w*3*(h-1); unsigned char *alpha = image->GetAlpha(); - if ( hasAlpha ) - alpha += w*(h-1); uint32 pos = 0; @@ -429,11 +426,6 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos pos++; } - - // subtract line we just added plus one line: - ptr -= 2*w*3; - if ( hasAlpha ) - alpha -= 2*w; }