Round the image scaling when not antialiased

When painting an image with antialiasing not turned on, round the
target area to closest integers (pixels).

Task-number: QTBUG-116297
Pick-to: 6.6
Change-Id: I64e78a9087ee042aef0ea297c48b5ead36697d10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
This commit is contained in:
Kaj Grönholm 2023-09-12 09:56:54 +03:00
parent 104a0a9ecd
commit 743c1cf96b

View File

@ -2342,9 +2342,16 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
}
SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
if (func && (!clip || clip->hasRectClip)) {
QRectF tr = qt_mapRect_non_normalizing(r, s->matrix);
if (!s->flags.antialiased) {
tr.setX(qRound(tr.x()));
tr.setY(qRound(tr.y()));
tr.setWidth(qRound(tr.width()));
tr.setHeight(qRound(tr.height()));
}
func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
img.bits(), img.bytesPerLine(), img.height(),
qt_mapRect_non_normalizing(r, s->matrix), sr,
tr, sr,
!clip ? d->deviceRect : clip->clipRect,
s->intOpacity);
return;