summaryrefslogtreecommitdiffstats
path: root/src/multimediawidgets
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2018-01-15 15:43:20 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-03-22 11:00:46 +0000
commit3b1f2ac5d3b78c33392a625a134c2a09390f3fba (patch)
treea91a505a505aa1349795383c79ae7177f7b31106 /src/multimediawidgets
parent4c7a376f4b4c43bc6626fe59815264f19573e288 (diff)
Fix target rectangle coordinates while painting image with QPainter
QRectF::setX() may change the width. QRectF::setY() may change the height. If either width or height has been adjusted incorrect target rect is applied to draw an image which will cause some artefacts to be shown (like rectangle with a garbage) and incorrect size of actual content. Task-number: QTBUG-53594 Change-Id: Iee92aaf908952d7809e8ad62f8d1126b7ecac642 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/multimediawidgets')
-rw-r--r--src/multimediawidgets/qpaintervideosurface.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
index 0147690e1..0396f9fc0 100644
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ b/src/multimediawidgets/qpaintervideosurface.cpp
@@ -202,12 +202,13 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::paint(
if (m_scanLineDirection == QVideoSurfaceFormat::BottomToTop) {
transform.scale(1, -1);
transform.translate(0, -target.bottom());
- targetRect.setY(0);
+ targetRect = QRectF(target.x(), 0, target.width(), target.height());
}
+
if (m_mirrored) {
transform.scale(-1, 1);
transform.translate(-target.right(), 0);
- targetRect.setX(0);
+ targetRect = QRectF(0, targetRect.y(), target.width(), target.height());
}
painter->setTransform(transform);
painter->drawImage(targetRect, image, source);