fixing truncation error in GetSubBitmap

fixes #18362
This commit is contained in:
Stefan Csomor
2019-03-17 12:19:53 +01:00
parent cbaab700d0
commit cfded96627

View File

@@ -1026,8 +1026,8 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
int sourcelinesize = GetBitmapData()->GetBytesPerRow() ;
int destlinesize = ret.GetBitmapData()->GetBytesPerRow() ;
unsigned char *source = sourcedata + int(rect.x * scale * 4 + rect.y *scale * sourcelinesize) ;
unsigned char *dest = destdata ;
unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize;
unsigned char* dest = destdata;
for (int yy = 0; yy < destheight; ++yy, source += sourcelinesize , dest += destlinesize)
{