summaryrefslogtreecommitdiff
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-24 10:58:22 +0200
commit3ff4cd600454d1589228aeb68230336d6b721839 (patch)
tree92736acf8dcc25bc508e9f1d39964a1d7c4691d6
parent36060ad8dca6720c77dfa2bf0292978d4eadb2db (diff)
downloadqtwayland-3ff4cd600454d1589228aeb68230336d6b721839.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> (cherry picked from commit 060024e2fc9335d4fc999253c9d6ed560c7ffb0c)
-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 8d4eeddb..95bf0f91 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1417,7 +1417,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);