diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-03-01 11:32:58 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-03-01 11:32:58 +0300 |
commit | 4a4701b43c53d1a4946e224821ba398548b22043 (patch) | |
tree | 5367f45f7f7cf8cfe14a2c00839ba590e960f9f1 /source/blender/draw/engines/image | |
parent | 34f6a9943333f4b6c9727efb5db7bca1ffc7c531 (diff) |
Fix painting on none 256 aligned images.
Internally the update tiles are 256x256. Due to some miscalculations
tiles were not generated correctly if the dimension of the image wasn't
a multifold of 256.
Diffstat (limited to 'source/blender/draw/engines/image')
-rw-r--r-- | source/blender/draw/engines/image/image_drawing_mode.hh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 4564ef87025..267b0477a29 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<typename TextureMethod> 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<ImageTileData>::CollectResult &iterator, |