aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp2
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp7
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h1
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp8
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext_p.h1
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp10
6 files changed, 23 insertions, 6 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index 90090e1cc0..381fd7eb69 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -323,6 +323,8 @@ void QSGRenderer::preprocess()
// For the default case, when this does not happen, the cost is negligible.
QSet<QSGNode *> items = m_nodes_to_preprocess;
+ m_context->preprocess();
+
for (QSet<QSGNode *>::const_iterator it = items.constBegin();
it != items.constEnd(); ++it) {
QSGNode *n = *it;
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index e3c951e5ed..28d8c19d5d 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -395,6 +395,13 @@ void QSGRenderContext::endSync()
}
/*!
+ Do necessary preprocessing before the frame
+*/
+void QSGRenderContext::preprocess()
+{
+}
+
+/*!
Factory function for scene graph backends of the distance-field glyph cache.
*/
QSGDistanceFieldGlyphCache *QSGRenderContext::distanceFieldGlyphCache(const QRawFont &)
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index d389420907..275a753fb3 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -192,6 +192,7 @@ public:
virtual void endSync();
+ virtual void preprocess();
virtual QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font);
QSGTexture *textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window);
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index 16f9b63036..bf7bb052bb 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -430,6 +430,14 @@ bool QSGDefaultRenderContext::separateIndexBuffer() const
return isWebGL;
}
+void QSGDefaultRenderContext::preprocess()
+{
+ for (auto it = m_glyphCaches.begin(); it != m_glyphCaches.end(); ++it) {
+ it.value()->processPendingGlyphs();
+ it.value()->update();
+ }
+}
+
QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font)
{
QString key = fontKey(font);
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
index 97ed681f9a..e90a11eda6 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h
+++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
@@ -120,6 +120,7 @@ public:
void renderNextRhiFrame(QSGRenderer *renderer) override;
void endNextRhiFrame(QSGRenderer *renderer) override;
+ void preprocess() override;
QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font) override;
virtual QSharedPointer<QSGDepthStencilBuffer> depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo);
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index 0fa680a244..45996aff87 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -57,7 +57,6 @@ QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGRenderContext *context)
{
m_geometry.setDrawingMode(GL_TRIANGLES);
setGeometry(&m_geometry);
- setFlag(UsePreprocess);
#ifdef QSG_RUNTIME_DESCRIPTION
qsgnode_set_description(this, QLatin1String("glyphs"));
#endif
@@ -105,6 +104,7 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR
m_dirtyGeometry = true;
m_dirtyMaterial = true;
+ setFlag(UsePreprocess);
QSGDistanceFieldGlyphCache *oldCache = m_glyph_cache;
m_glyph_cache = m_context->distanceFieldGlyphCache(m_glyphs.rawFont());
@@ -152,13 +152,10 @@ void QSGDistanceFieldGlyphNode::update()
void QSGDistanceFieldGlyphNode::preprocess()
{
- Q_ASSERT(m_glyph_cache);
-
- m_glyph_cache->processPendingGlyphs();
- m_glyph_cache->update();
-
if (m_dirtyGeometry)
updateGeometry();
+
+ setFlag(UsePreprocess, false);
}
void QSGDistanceFieldGlyphNode::invalidateGlyphs(const QVector<quint32> &glyphs)
@@ -169,6 +166,7 @@ void QSGDistanceFieldGlyphNode::invalidateGlyphs(const QVector<quint32> &glyphs)
for (int i = 0; i < glyphs.count(); ++i) {
if (m_allGlyphIndexesLookup.contains(glyphs.at(i))) {
m_dirtyGeometry = true;
+ setFlag(UsePreprocess);
return;
}
}