diff options
Diffstat (limited to 'src/quick/items/qquickshadereffectsource.cpp')
-rw-r--r-- | src/quick/items/qquickshadereffectsource.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index bdfef7ca88..59b788643a 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlFboOverlay, QML_FBO_OVERLAY) +DEFINE_BOOL_CONFIG_OPTION(qmlFboFlushBeforeDetach, QML_FBO_FLUSH_BEFORE_DETACH) namespace { @@ -75,6 +76,8 @@ namespace BindableFbo::~BindableFbo() { + if (qmlFboFlushBeforeDetach()) + glFlush(); if (m_depthStencil) m_depthStencil->detach(); } @@ -128,6 +131,7 @@ void QQuickShaderEffectSourceNode::markDirtyTexture() QQuickShaderEffectTexture::QQuickShaderEffectTexture(QQuickItem *shaderSource) : QSGDynamicTexture() , m_item(0) + , m_device_pixel_ratio(1) , m_format(GL_RGBA) , m_renderer(0) , m_fbo(0) @@ -310,6 +314,7 @@ void QQuickShaderEffectTexture::grab() m_renderer = m_context->createRenderer(); connect(m_renderer, SIGNAL(sceneGraphChanged()), this, SLOT(markDirtyTexture())); } + m_renderer->setDevicePixelRatio(m_device_pixel_ratio); m_renderer->setRootNode(static_cast<QSGRootNode *>(root)); bool deleteFboLater = false; @@ -957,11 +962,12 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint : m_textureSize; Q_ASSERT(!textureSize.isEmpty()); + QQuickItemPrivate *d = static_cast<QQuickItemPrivate *>(QObjectPrivate::get(this)); + // Crate large textures on high-dpi displays. - if (sourceItem() && sourceItem()->window()) - textureSize *= sourceItem()->window()->devicePixelRatio(); + if (sourceItem()) + textureSize *= d->window->devicePixelRatio(); - QQuickItemPrivate *d = static_cast<QQuickItemPrivate *>(QObjectPrivate::get(this)); const QSize minTextureSize = d->sceneGraphContext()->minimumFBOSize(); // Keep power-of-two by doubling the size. while (textureSize.width() < minTextureSize.width()) @@ -969,6 +975,7 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint while (textureSize.height() < minTextureSize.height()) textureSize.rheight() *= 2; + m_texture->setDevicePixelRatio(d->window->devicePixelRatio()); m_texture->setSize(textureSize); m_texture->setRecursive(m_recursive); m_texture->setFormat(GLenum(m_format)); |