Fixed calculated image pitch being off-by-one in some cases.
The variable linebytes sometimes counted one extra byte, which is OK for allocating but not when accessing the image later on. Calculate the value in a slightly different way and made the variable const. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
28b31a2ad2
commit
649df4bff8
@ -640,7 +640,9 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
|
||||
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
|
||||
|
||||
// scanlinesize if determined by spp and bps
|
||||
// scanlinesize is determined by spp and bps
|
||||
const tsize_t linebytes =
|
||||
(tsize_t)((image->GetWidth() * spp * bps + 7) / 8);
|
||||
tsize_t linebytes = (tsize_t)image->GetWidth() * spp * bps / 8;
|
||||
|
||||
if ( (image->GetWidth() % 8 > 0) && (spp * bps < 8) )
|
||||
|
Loading…
Reference in New Issue
Block a user