Always convert to ARGB before rounding.

This commit is contained in:
John Preston 2022-02-08 11:05:52 +03:00
parent 7e1effeeeb
commit f93c2bb5e5

View file

@ -1011,6 +1011,10 @@ QImage Round(
return std::move(image);
}
image = std::move(image).convertToFormat(
QImage::Format_ARGB32_Premultiplied);
Assert(!image.isNull());
// We need to detach image first (if it is shared), before we
// count some offsets using QImage::bytesPerLine etc, because
// bytesPerLine may change on detach, this leads to crashes:
@ -1068,10 +1072,6 @@ QImage Round(
}
Assert(!image.isNull());
image = std::move(image).convertToFormat(
QImage::Format_ARGB32_Premultiplied);
Assert(!image.isNull());
const auto masks = CornersMask(radius);
return Round(std::move(image), masks, corners, target);
}