aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2011-05-13 15:57:51 +0200
committerYoann Lopes <yoann.lopes@nokia.com>2011-05-13 16:00:29 +0200
commit367a4fb872c1836f08b2b272b58396114040165d (patch)
treeeab2a4780aecd2f1a98ea9f10e1d83501101053f /src
parent30327650798ba63281c7b9344c9d824d00dce82a (diff)
Call QSGPaintedItem::paint() when the scene graph is synced.
At that moment the GUI thread is blocked and it is therefore safe to call paint() from the scenegraph thread.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/items/qsgpainteditem.cpp3
-rw-r--r--src/declarative/scenegraph/util/qsgpainternode.cpp11
-rw-r--r--src/declarative/scenegraph/util/qsgpainternode_p.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp
index 800e37b324..775405c1fb 100644
--- a/src/declarative/items/qsgpainteditem.cpp
+++ b/src/declarative/items/qsgpainteditem.cpp
@@ -419,7 +419,8 @@ void QSGPaintedItem::setRenderTarget(RenderTarget target)
\note The QML Scene Graph uses two separate threads, the main thread does things such as
processing events or updating animations while a second thread does the actual OpenGL rendering.
As a consequence, paint() is not called from the main GUI thread but from the GL enabled
- renderer thread.
+ renderer thread. At the moment paint() is called, the GUI thread is blocked and this is
+ therefore thread-safe.
*/
/*!
diff --git a/src/declarative/scenegraph/util/qsgpainternode.cpp b/src/declarative/scenegraph/util/qsgpainternode.cpp
index d3dae11202..bcf63ab51f 100644
--- a/src/declarative/scenegraph/util/qsgpainternode.cpp
+++ b/src/declarative/scenegraph/util/qsgpainternode.cpp
@@ -127,7 +127,6 @@ QSGPainterNode::QSGPainterNode(QSGPaintedItem *item)
setMaterial(&m_materialO);
setOpaqueMaterial(&m_material);
setGeometry(&m_geometry);
- setFlag(UsePreprocess);
}
QSGPainterNode::~QSGPainterNode()
@@ -137,11 +136,8 @@ QSGPainterNode::~QSGPainterNode()
delete m_multisampledFbo;
}
-void QSGPainterNode::preprocess()
+void QSGPainterNode::paint()
{
- if (!m_dirtyContents)
- return;
-
QRect dirtyRect = m_dirtyRect.isNull() ? QRect(0, 0, m_size.width(), m_size.height()) : m_dirtyRect;
QPainter painter;
@@ -181,7 +177,6 @@ void QSGPainterNode::preprocess()
QGLFramebufferObject::blitFramebuffer(m_fbo, dirtyRect, m_multisampledFbo, dirtyRect);
}
- m_dirtyContents = false;
m_dirtyRect = QRect();
}
@@ -194,9 +189,13 @@ void QSGPainterNode::update()
if (m_dirtyTexture)
updateTexture();
+ if (m_dirtyContents)
+ paint();
+
m_dirtyGeometry = false;
m_dirtyRenderTarget = false;
m_dirtyTexture = false;
+ m_dirtyContents = false;
}
void QSGPainterNode::updateTexture()
diff --git a/src/declarative/scenegraph/util/qsgpainternode_p.h b/src/declarative/scenegraph/util/qsgpainternode_p.h
index f2fdbe5d26..0fba6e9c26 100644
--- a/src/declarative/scenegraph/util/qsgpainternode_p.h
+++ b/src/declarative/scenegraph/util/qsgpainternode_p.h
@@ -101,7 +101,7 @@ public:
void update();
- void preprocess();
+ void paint();
private:
void updateTexture();