summaryrefslogtreecommitdiffstats
path: root/src/render/framegraph
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-12-10 16:20:08 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-12-11 16:15:38 +0000
commit7aab0e3b850cc17735ac19ab7a6e7db2bac1cb83 (patch)
tree721c7dba20026f97571efd06cb758b8448244132 /src/render/framegraph
parent8470becd886d299c1be892d8113dfff216035611 (diff)
Add QBlitFramebuffer auto-parenting behavior
As is common with other nodes. Task-number: QTBUG-65081 Change-Id: I12ccd2fb5344e116f2f5333b73edb4562799543d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/framegraph')
-rw-r--r--src/render/framegraph/qblitframebuffer.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/render/framegraph/qblitframebuffer.cpp b/src/render/framegraph/qblitframebuffer.cpp
index 505bab96c..629ae04f6 100644
--- a/src/render/framegraph/qblitframebuffer.cpp
+++ b/src/render/framegraph/qblitframebuffer.cpp
@@ -121,7 +121,21 @@ void QBlitFramebuffer::setSource(QRenderTarget *source)
{
Q_D(QBlitFramebuffer);
if (d->m_source != source) {
+ if (d->m_source) {
+ // Remove bookkeeping connection
+ d->unregisterDestructionHelper(d->m_source);
+ }
+
d->m_source = source;
+
+ if (d->m_source) {
+ // Ensures proper bookkeeping. Calls us back with nullptr in case the rt gets destroyed.
+ d->registerDestructionHelper(d->m_source, &QBlitFramebuffer::setSource, d->m_source);
+
+ if (!d->m_source->parent())
+ d->m_source->setParent(this);
+ }
+
emit sourceChanged();
}
}
@@ -130,7 +144,21 @@ void QBlitFramebuffer::setDestination(QRenderTarget *destination)
{
Q_D(QBlitFramebuffer);
if (d->m_destination != destination) {
+ if (d->m_destination) {
+ // Remove bookkeeping connection
+ d->unregisterDestructionHelper(d->m_destination);
+ }
+
d->m_destination = destination;
+
+ if (d->m_destination) {
+ // Ensures proper bookkeeping. Calls us back with nullptr in case the rt gets destroyed.
+ d->registerDestructionHelper(d->m_destination, &QBlitFramebuffer::setDestination, d->m_destination);
+
+ if (!d->m_destination->parent())
+ d->m_destination->setParent(this);
+ }
+
emit destinationChanged();
}
}