]> git.saurik.com Git - wxWidgets.git/commitdiff
Read TIFF images from top to bottom instead of bottom to top.
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Sun, 28 Aug 2011 21:59:36 +0000 (21:59 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Sun, 28 Aug 2011 21:59:36 +0000 (21:59 +0000)
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

index a426c6a8b40020b0811ce250cc3adcdc87fc81e2..b643ff24e30d14e979ec725db06d2c7f9776133d 100644 (file)
@@ -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;
     }