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
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) )