diff options
-rw-r--r-- | src/effects/private/qgfxsourceproxy.cpp | 17 | ||||
-rw-r--r-- | src/effects/private/qgfxsourceproxy_p.h | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/effects/private/qgfxsourceproxy.cpp b/src/effects/private/qgfxsourceproxy.cpp index 88e2780..cf64807 100644 --- a/src/effects/private/qgfxsourceproxy.cpp +++ b/src/effects/private/qgfxsourceproxy.cpp @@ -74,8 +74,18 @@ void QGfxSourceProxy::setInput(QQuickItem *input) { if (m_input == input) return; + + if (m_input != nullptr) + disconnect(m_input, nullptr, this, nullptr); m_input = input; polish(); + if (m_input != nullptr) { + if (QQuickImage *image = qobject_cast<QQuickImage *>(m_input)) { + connect(image, &QQuickImage::sourceSizeChanged, this, &QGfxSourceProxy::repolish); + connect(image, &QQuickImage::fillModeChanged, this, &QGfxSourceProxy::repolish); + } + connect(m_input, &QQuickItem::childrenChanged, this, &QGfxSourceProxy::repolish); + } emit inputChanged(); } @@ -117,6 +127,11 @@ void QGfxSourceProxy::useProxy() setOutput(m_proxy); } +void QGfxSourceProxy::repolish() +{ + polish(); +} + QObject *QGfxSourceProxy::findLayer(QQuickItem *item) { if (!item) @@ -177,7 +192,7 @@ void QGfxSourceProxy::updatePolish() if (shaderSource->sourceRect() == m_sourceRect || m_sourceRect.isEmpty()) direct = true; - } else if (!padded && ((image && image->fillMode() == QQuickImage::Stretch) + } else if (!padded && ((image && image->fillMode() == QQuickImage::Stretch && !image->sourceSize().isNull()) || (!image && m_input->isTextureProvider()) ) ) { diff --git a/src/effects/private/qgfxsourceproxy_p.h b/src/effects/private/qgfxsourceproxy_p.h index 4a7bd01..8fe592c 100644 --- a/src/effects/private/qgfxsourceproxy_p.h +++ b/src/effects/private/qgfxsourceproxy_p.h @@ -104,6 +104,9 @@ signals: void activeChanged(); void interpolationChanged(); +private slots: + void repolish(); + private: void setOutput(QQuickItem *output); void useProxy(); |