Fix checks in small image round request.

This commit is contained in:
John Preston 2020-08-13 15:10:42 +04:00
parent b534567e11
commit 4c04017737

View file

@ -458,9 +458,9 @@ void prepareRound(
} }
auto cornerWidth = cornerMasks[0].width(); auto cornerWidth = cornerMasks[0].width();
auto cornerHeight = cornerMasks[0].height(); auto cornerHeight = cornerMasks[0].height();
auto imageWidth = image.width(); auto targetWidth = target.width();
auto imageHeight = image.height(); auto targetHeight = target.height();
if (imageWidth < 2 * cornerWidth || imageHeight < 2 * cornerHeight) { if (targetWidth < 2 * cornerWidth || targetHeight < 2 * cornerHeight) {
return; return;
} }
@ -475,9 +475,9 @@ void prepareRound(
Assert(image.depth() == static_cast<int>((imageIntsPerPixel * sizeof(uint32)) << 3)); Assert(image.depth() == static_cast<int>((imageIntsPerPixel * sizeof(uint32)) << 3));
Assert(image.bytesPerLine() == (imageIntsPerLine << 2)); Assert(image.bytesPerLine() == (imageIntsPerLine << 2));
auto intsTopLeft = ints + target.x() + target.y() * imageIntsPerLine; auto intsTopLeft = ints + target.x() + target.y() * imageIntsPerLine;
auto intsTopRight = ints + target.x() + target.width() - cornerWidth + target.y() * imageIntsPerLine; auto intsTopRight = ints + target.x() + targetWidth - cornerWidth + target.y() * imageIntsPerLine;
auto intsBottomLeft = ints + target.x() + (target.y() + target.height() - cornerHeight) * imageIntsPerLine; auto intsBottomLeft = ints + target.x() + (target.y() + targetHeight - cornerHeight) * imageIntsPerLine;
auto intsBottomRight = ints + target.x() + target.width() - cornerWidth + (target.y() + target.height() - cornerHeight) * imageIntsPerLine; auto intsBottomRight = ints + target.x() + targetWidth - cornerWidth + (target.y() + targetHeight - cornerHeight) * imageIntsPerLine;
auto maskCorner = [&](uint32 *imageInts, const QImage &mask) { auto maskCorner = [&](uint32 *imageInts, const QImage &mask) {
auto maskWidth = mask.width(); auto maskWidth = mask.width();
auto maskHeight = mask.height(); auto maskHeight = mask.height();