From 6c5b42b47e4b8b08d5188019171c779b3748236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 27 Jan 2014 15:15:12 +0100 Subject: Move logic for determining native vs. DF text into single factory function Makes QSGContext::createGlyphNode() the central point of determining which glyph node to produce, instead of letting the caller call two different versions of the factory, each one calling the other in various cases and behind various ifdefs. Change-Id: I30fb17cceab45d9e13ddf3ece7a65f220c5e5acd Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/qsgcontext.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src/quick/scenegraph/qsgcontext.cpp') diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 829d33a0d7..202ae91ac3 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -252,33 +252,15 @@ QSGImageNode *QSGContext::createImageNode() : new QSGDefaultImageNode; } -/*! - Factory function for scene graph backends of the Text elements which supports native - text rendering. Used in special cases where native look and feel is a main objective. -*/ -QSGGlyphNode *QSGContext::createNativeGlyphNode(QSGRenderContext *rc) -{ -#if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2_ANGLE) - Q_D(QSGContext); - if (d->distanceFieldDisabled) - return new QSGDefaultGlyphNode; - else - return createGlyphNode(rc); -#else - Q_UNUSED(rc); - return new QSGDefaultGlyphNode; -#endif -} - /*! Factory function for scene graph backends of the Text elements; */ -QSGGlyphNode *QSGContext::createGlyphNode(QSGRenderContext *rc) +QSGGlyphNode *QSGContext::createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) { Q_D(QSGContext); - if (d->distanceFieldDisabled) { - return createNativeGlyphNode(rc); + if (d->distanceFieldDisabled || preferNativeGlyphNode) { + return new QSGDefaultGlyphNode; } else { QSGDistanceFieldGlyphNode *node = new QSGDistanceFieldGlyphNode(rc); node->setPreferredAntialiasingMode(d->distanceFieldAntialiasing); -- cgit v1.2.3