Skip to content

Commit

Permalink
Fix decodedRoiRect row being negative
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Mar 4, 2023
1 parent 0d42645 commit 2161ecc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/decoders/SmartPngDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ struct SmartPngDecoder::Impl

auto width = png_get_image_width(png_ptr, self->info_ptr);
size_t height = png_get_image_height(png_ptr, self->info_ptr);
self->q->updateDecodedRoiRect(QRect(0, row - 1/*row seems to be one-based*/, width, 1));
png_uint_32 fixedRow = std::max(1u, row) - 1; // row is sometimes 1 and sometimes zero
self->q->updateDecodedRoiRect(QRect(0, fixedRow, width, 1));
if (row % 16 == 0)
{
self->q->cancelCallback();
Expand Down

0 comments on commit 2161ecc

Please sign in to comment.