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.

Pick-to: 6.1 5.15
Fixes: QTBUG-93475
Change-Id: If5b3af324f4e525cee3dc448ba41fdd8a91cc880
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-05-06 12:05:47 +02:00
parent 23e6eb53f3
commit ddc5af9f17

View File

@ -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);