Fix colour shift in Crop function due to not multiplying x position by colours

This commit is contained in:
Isaac Connor 2021-02-02 23:19:06 -05:00
parent 70313ce152
commit c0eb790e45
2 changed files with 4 additions and 4 deletions

View File

@ -1416,8 +1416,8 @@ bool Image::Crop( unsigned int lo_x, unsigned int lo_y, unsigned int hi_x, unsig
unsigned int new_stride = new_width * colours; unsigned int new_stride = new_width * colours;
for ( unsigned int y = lo_y, ny = 0; y <= hi_y; y++, ny++ ) { for ( unsigned int y = lo_y, ny = 0; y <= hi_y; y++, ny++ ) {
unsigned char *pbuf = &buffer[((y*linesize)+lo_x)]; unsigned char *pbuf = &buffer[((y*linesize)+(lo_x*colours))];
unsigned char *pnbuf = &new_buffer[(ny*new_width)*colours]; unsigned char *pnbuf = &new_buffer[ny*new_stride];
memcpy(pnbuf, pbuf, new_stride); memcpy(pnbuf, pbuf, new_stride);
} }

@ -1 +1 @@
Subproject commit 14292374ccf1328f2d5db20897bd06f99ba4d938 Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef