Fix clamp limit to avoid assertion in debug mode on visual studio on windows

This commit is contained in:
Martín Capello 2022-10-12 15:27:40 -03:00 committed by David Capello
parent 20902e35b8
commit 04e095bbd5

View File

@ -2624,10 +2624,8 @@ void Editor::pasteImage(const Image* image, const Mask* mask)
// Limit the image inside the sprite's bounds.
if (sprite->width() <= image->width() ||
sprite->height() <= image->height()) {
// TODO review this (I think limits are wrong and high limit can
// be negative here)
x = std::clamp(x, 0, sprite->width() - image->width());
y = std::clamp(y, 0, sprite->height() - image->height());
x = std::clamp(x, 0, image->width() - sprite->width());
y = std::clamp(y, 0, image->height() - sprite->height());
}
else {
// Also we always limit the 1 image pixel inside the sprite's bounds.