diff --git a/source/blender/blenkernel/intern/image_partial_update.cc b/source/blender/blenkernel/intern/image_partial_update.cc index 7e187c2014e6..bec3c193af55 100644 --- a/source/blender/blenkernel/intern/image_partial_update.cc +++ b/source/blender/blenkernel/intern/image_partial_update.cc @@ -213,8 +213,8 @@ struct TileChangeset { tile_width = image_buffer->x; tile_height = image_buffer->y; - int chunk_x_len = tile_width / CHUNK_SIZE; - int chunk_y_len = tile_height / CHUNK_SIZE; + int chunk_x_len = (tile_width + CHUNK_SIZE - 1) / CHUNK_SIZE; + int chunk_y_len = (tile_height + CHUNK_SIZE - 1) / CHUNK_SIZE; init_chunks(chunk_x_len, chunk_y_len); return true; } diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 4564ef87025f..267b0477a294 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -229,7 +229,21 @@ template class ScreenSpaceDrawingMode : public AbstractD BLI_assert(float_buffer->rect == nullptr); BLI_assert(src->rect_float == nullptr); BLI_assert(src->rect != nullptr); - IMB_float_from_rect_ex(float_buffer, src, &iterator.changed_region.region); + + /* Calculate the overlap between the updated region and the buffer size. Partial Update Checker + * always returns a tile (256x256). Which could lay partially outside the buffer when using + * different resolutions. + */ + rcti buffer_rect; + BLI_rcti_init(&buffer_rect, 0, float_buffer->x, 0, float_buffer->y); + rcti clipped_update_region; + const bool has_overlap = BLI_rcti_isect( + &buffer_rect, &iterator.changed_region.region, &clipped_update_region); + if (!has_overlap) { + return; + } + + IMB_float_from_rect_ex(float_buffer, src, &clipped_update_region); } void do_partial_update(PartialUpdateChecker::CollectResult &iterator,