aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/scenegraph/util/qsgpainternode.cpp
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2011-10-20 10:01:39 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-23 14:44:23 +0200
commit210bb5a06811057a8ce2747bd187817a06968042 (patch)
treec527f929598d7e7858d18b46b7c027aea6d276f0 /src/declarative/scenegraph/util/qsgpainternode.cpp
parentbfb3c424abc7c839dc44de0e36024ede99ece736 (diff)
Provide a way to cheaply flip your painted FBO
After recent changes the painted images are upside down from previous and there is no way to get at the texture coordinates to flip them back without reimplementing QSGPainterNode and QSGPaintedItem. This change adds only an enum and has minimal impact, while providing useful functionality that also fixes this problem. Change-Id: I6884da884d9303f6e08a984d4560cc7f7728d918 Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'src/declarative/scenegraph/util/qsgpainternode.cpp')
-rw-r--r--src/declarative/scenegraph/util/qsgpainternode.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/declarative/scenegraph/util/qsgpainternode.cpp b/src/declarative/scenegraph/util/qsgpainternode.cpp
index 3f07f20695..1f44750f98 100644
--- a/src/declarative/scenegraph/util/qsgpainternode.cpp
+++ b/src/declarative/scenegraph/util/qsgpainternode.cpp
@@ -238,8 +238,11 @@ void QSGPainterNode::updateGeometry()
source = QRectF(0, 0, 1, 1);
else
source = QRectF(0, 0, qreal(m_size.width()) / m_fboSize.width(), qreal(m_size.height()) / m_fboSize.height());
+ QRectF dest(0, 0, m_size.width(), m_size.height());
+ if (m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject)
+ dest = QRectF(QPointF(0, m_size.height()), QPointF(m_size.width(), 0));
QSGGeometry::updateTexturedRectGeometry(&m_geometry,
- QRectF(0, 0, m_size.width(), m_size.height()),
+ dest,
source);
markDirty(DirtyGeometry);
}
@@ -262,7 +265,7 @@ void QSGPainterNode::updateRenderTarget()
if (!m_multisamplingSupported && m_smoothPainting)
m_actualRenderTarget = QQuickPaintedItem::Image;
else
- m_actualRenderTarget = QQuickPaintedItem::FramebufferObject;
+ m_actualRenderTarget = m_preferredRenderTarget;
}
if (oldTarget != m_actualRenderTarget) {
m_image = QImage();
@@ -271,7 +274,8 @@ void QSGPainterNode::updateRenderTarget()
m_fbo = m_multisampledFbo = 0;
}
- if (m_actualRenderTarget == QQuickPaintedItem::FramebufferObject) {
+ if (m_actualRenderTarget == QQuickPaintedItem::FramebufferObject ||
+ m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject) {
const QOpenGLContext *ctx = m_context->glContext();
if (m_fbo && !m_dirtyGeometry && (!ctx->format().samples() || !m_multisamplingSupported))
return;