summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-05 07:57:38 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-23 11:55:15 +0200
commit060024e2fc9335d4fc999253c9d6ed560c7ffb0c (patch)
tree9eed1e519cffd73774b775d315363754720e9c9c /src/compositor
parent639bd92682f5f61f15f97f78ccd9791bec852b6c (diff)
downloadqtwayland-060024e2fc9335d4fc999253c9d6ed560c7ffb0c.tar.gz
Implement wp_viewporter support for video buffer formats
Some EGL image formats (the YUV formats specifically) cannot be handled by the built-in node types in the Qt Quick scene graph and use a custom material and geometry setup. In this setup, the wp_viewporter source rectangle was ignored and the entire texture was always sampled. This caused problems e.g. for video frames supplied by GStreamer. [ChangeLog][Extensions] Support for wp_viewporter extended to cover less common buffer formats. Pick-to: 5.15 6.1 6.2 Task-number: QTBUG-95464 Change-Id: I2504c6cd7d82e17d28e930a59d9ec71b25779acb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index bf165b15..ace1b6ad 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1531,7 +1531,17 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
material->bind();
}
- QSGGeometry::updateTexturedRectGeometry(geometry, rect, QRectF(0, 0, 1, 1));
+ const QSize surfaceSize = ref.size() / surface()->bufferScale();
+ const QRectF sourceGeometry = surface()->sourceGeometry();
+ const QRectF normalizedCoordinates =
+ sourceGeometry.isValid()
+ ? QRectF(sourceGeometry.x() / surfaceSize.width(),
+ sourceGeometry.y() / surfaceSize.height(),
+ sourceGeometry.width() / surfaceSize.width(),
+ sourceGeometry.height() / surfaceSize.height())
+ : QRectF(0, 0, 1, 1);
+
+ QSGGeometry::updateTexturedRectGeometry(geometry, rect, normalizedCoordinates);
node->setGeometry(geometry);
node->setFlag(QSGNode::OwnsGeometry, true);