From a22acb8ba59285219a1e57d403ecd865936255e4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 6 May 2021 12:05:47 +0200 Subject: [PATCH] Avoid fast transform paint path on values it can't handle It has a problem with very small targets, and coordinates can't exceed the same bounds we have on dimensions. Fixes: QTBUG-93475 Change-Id: If5b3af324f4e525cee3dc448ba41fdd8a91cc880 Reviewed-by: Eirik Aavitsland (cherry picked from commit ddc5af9f17474129223c7bbac58b57bb3ed0ff74) Reviewed-by: Qt Cherry-pick Bot --- src/gui/painting/qpaintengine_raster.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 26f8de5b8b0..c527b167f68 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2357,15 +2357,19 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe QRectF targetBounds = s->matrix.mapRect(r); bool exceedsPrecision = r.width() > 0x7fff || r.height() > 0x7fff + || targetBounds.left() < -0x7fff + || targetBounds.top() < -0x7fff + || targetBounds.right() > 0x7fff + || targetBounds.bottom() > 0x7fff || targetBounds.width() > 0x7fff || targetBounds.height() > 0x7fff || s->matrix.m11() >= 512 || s->matrix.m22() >= 512; - if (!exceedsPrecision && d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) { if (s->matrix.type() > QTransform::TxScale) { SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; - if (func && (!clip || clip->hasRectClip)) { + // The fast transform methods doesn't really work on small targets, see QTBUG-93475 + if (func && (!clip || clip->hasRectClip) && targetBounds.width() >= 16 && targetBounds.height() >= 16) { func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(), img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect, s->matrix, s->intOpacity);