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
This commit is contained in:
parent
f2de33ede4
commit
5d2be7cc55
@ -394,7 +394,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
if ( hasAlpha )
|
if ( hasAlpha )
|
||||||
image->SetAlpha();
|
image->SetAlpha();
|
||||||
|
|
||||||
if (!TIFFReadRGBAImage( tif, w, h, raster, 0 ))
|
if (!TIFFReadRGBAImageOriented( tif, w, h, raster, ORIENTATION_TOPLEFT, 0 ))
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -409,11 +409,8 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *ptr = image->GetData();
|
unsigned char *ptr = image->GetData();
|
||||||
ptr += w*3*(h-1);
|
|
||||||
|
|
||||||
unsigned char *alpha = image->GetAlpha();
|
unsigned char *alpha = image->GetAlpha();
|
||||||
if ( hasAlpha )
|
|
||||||
alpha += w*(h-1);
|
|
||||||
|
|
||||||
uint32 pos = 0;
|
uint32 pos = 0;
|
||||||
|
|
||||||
@ -429,11 +426,6 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
|
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// subtract line we just added plus one line:
|
|
||||||
ptr -= 2*w*3;
|
|
||||||
if ( hasAlpha )
|
|
||||||
alpha -= 2*w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user