summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-06 12:05:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-10 13:59:55 +0000
commita22acb8ba59285219a1e57d403ecd865936255e4 (patch)
tree3fabf12560263664c6c38bbcd3fae4e2bc2040a5 /src/gui/painting/qpaintengine_raster.cpp
parentb40453ce128a1915a9e024a1cf78d71c4834c5d7 (diff)
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 <eirik.aavitsland@qt.io> (cherry picked from commit ddc5af9f17474129223c7bbac58b57bb3ed0ff74) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 26f8de5b8b..c527b167f6 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);