diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-01-15 15:43:20 +0100 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-03-22 11:00:46 +0000 |
commit | 3b1f2ac5d3b78c33392a625a134c2a09390f3fba (patch) | |
tree | a91a505a505aa1349795383c79ae7177f7b31106 /src | |
parent | 4c7a376f4b4c43bc6626fe59815264f19573e288 (diff) | |
download | qtmultimedia-3b1f2ac5d3b78c33392a625a134c2a09390f3fba.tar.gz |
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')
-rw-r--r-- | src/multimediawidgets/qpaintervideosurface.cpp | 5 |
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); |