diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-03-13 18:33:58 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-03-21 15:22:56 +0000 |
commit | 59d8fa914d5d72a7973b91e67235e6fdf9686d7d (patch) | |
tree | 5a384904e1a20a41da87c9ce632826c013484e12 /src/quick/scenegraph | |
parent | b5903ba46e065b096d7bcc12b11cde32b1c0f0c7 (diff) |
Remove QSGDistanceFieldGlyphCacheManager
After the previous cleanups, it became clear that this didn't serve much
of a purpose, so let's remove it and simplify the implementation as a
result.
Change-Id: Iae2ff9c46762f0c7bdf4225a2c4df93bc8253902
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgadaptationlayer.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgadaptationlayer_p.h | 7 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 3 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultcontext.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrendercontext.cpp | 14 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdistancefieldglyphnode_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/scenegraph.pri | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgdistancefieldutil.cpp | 69 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgdistancefieldutil_p.h | 79 |
14 files changed, 12 insertions, 180 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 412023564f..f90706affe 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -40,7 +40,6 @@ #include "qsgadaptationlayer_p.h" #include <qmath.h> -#include <QtQuick/private/qsgdistancefieldutil_p.h> #include <QtQuick/private/qsgdistancefieldglyphnode_p.h> #include <QtQuick/private/qsgcontext_p.h> #include <private/qrawfont_p.h> @@ -57,9 +56,8 @@ static QElapsedTimer qsg_render_timer; QSGDistanceFieldGlyphCache::Texture QSGDistanceFieldGlyphCache::s_emptyTexture; -QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font) - : m_manager(man) - , m_pendingGlyphs(64) +QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font) + : m_pendingGlyphs(64) { Q_ASSERT(font.isValid()); diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index a8e35b1ac1..ba146b884f 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -73,7 +73,6 @@ QT_BEGIN_NAMESPACE class QSGNode; class QImage; class TextureReference; -class QSGDistanceFieldGlyphCacheManager; class QSGDistanceFieldGlyphNode; class QOpenGLContext; class QSGInternalImageNode; @@ -409,7 +408,7 @@ public: class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCache { public: - QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font); + QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font); virtual ~QSGDistanceFieldGlyphCache(); struct Metrics { @@ -443,8 +442,6 @@ public: bool operator == (const Texture &other) const { return textureId == other.textureId; } }; - const QSGDistanceFieldGlyphCacheManager *manager() const { return m_manager; } - const QRawFont &referenceFont() const { return m_referenceFont; } qreal fontScale(qreal pixelSize) const @@ -514,8 +511,6 @@ protected: inline bool isCoreProfile() const { return m_coreProfile; } private: - QSGDistanceFieldGlyphCacheManager *m_manager; - QRawFont m_referenceFont; int m_glyphCount; diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index d52f69c7a3..ff2379ecb5 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -333,7 +333,6 @@ QSGRendererInterface *QSGContext::rendererInterface(QSGRenderContext *renderCont QSGRenderContext::QSGRenderContext(QSGContext *context) : m_sg(context) - , m_distanceFieldCacheManager(0) { } diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 2f5d5790ee..bd10453131 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -78,7 +78,6 @@ class QSGMaterial; class QSGRenderLoop; class QSGLayer; class QQuickTextureFactory; -class QSGDistanceFieldGlyphCacheManager; class QSGContext; class QQuickPaintedItem; class QSGRendererInterface; @@ -194,7 +193,7 @@ protected: QMutex m_mutex; QHash<QQuickTextureFactory *, QSGTexture *> m_textures; QSet<QSGTexture *> m_texturesToDelete; - QSGDistanceFieldGlyphCacheManager *m_distanceFieldCacheManager; + QHash<QRawFont, QSGDistanceFieldGlyphCache*> m_glyphCaches; QSet<QFontEngine *> m_fontEnginesToClean; }; diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index d31a7025e5..be5fec9dab 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -39,7 +39,6 @@ #include "qsgdefaultcontext_p.h" -#include <QtQuick/private/qsgdistancefieldutil_p.h> #include <QtQuick/private/qsgdefaultinternalrectanglenode_p.h> #include <QtQuick/private/qsgdefaultinternalimagenode_p.h> #include <QtQuick/private/qsgdefaultpainternode_p.h> diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index f0a336e229..ba25172d2f 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -42,7 +42,6 @@ #include <QtGui/private/qdistancefield_p.h> #include <QtGui/private/qopenglcontext_p.h> #include <QtQml/private/qqmlglobal_p.h> -#include <QtQuick/private/qsgdistancefieldutil_p.h> #include <qopenglfunctions.h> #include <qopenglframebufferobject.h> #include <qmath.h> @@ -60,8 +59,8 @@ DEFINE_BOOL_CONFIG_OPTION(qsgPreferFullSizeGlyphCacheTextures, QSG_PREFER_FULLSI # define QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING 2 #endif -QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font) - : QSGDistanceFieldGlyphCache(man, c, font) +QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font) + : QSGDistanceFieldGlyphCache(c, font) , m_maxTextureSize(0) , m_maxTextureCount(3) , m_blitProgram(0) diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h index 57dc4a5d07..fe365495c2 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h @@ -69,7 +69,7 @@ class QOpenGLFunctions_3_2_Core; class Q_QUICK_PRIVATE_EXPORT QSGDefaultDistanceFieldGlyphCache : public QSGDistanceFieldGlyphCache { public: - QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font); + QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font); virtual ~QSGDefaultDistanceFieldGlyphCache(); void requestGlyphs(const QSet<glyph_t> &glyphs) override; diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 2c5b4ff5c8..7542068a53 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -45,7 +45,6 @@ #include <QtQuick/private/qsgrenderer_p.h> #include <QtQuick/private/qsgatlastexture_p.h> #include <QtQuick/private/qsgdefaultdistancefieldglyphcache_p.h> -#include <QtQuick/private/qsgdistancefieldutil_p.h> QT_BEGIN_NAMESPACE @@ -159,8 +158,8 @@ void QSGDefaultRenderContext::invalidate() delete m_depthStencilManager; m_depthStencilManager = 0; - delete m_distanceFieldCacheManager; - m_distanceFieldCacheManager = 0; + qDeleteAll(m_glyphCaches); + m_glyphCaches.clear(); if (m_gl->property(QSG_RENDERCONTEXT_PROPERTY) == QVariant::fromValue(this)) m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant()); @@ -294,13 +293,10 @@ QT_END_NAMESPACE QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font) { - if (!m_distanceFieldCacheManager) - m_distanceFieldCacheManager = new QSGDistanceFieldGlyphCacheManager; - - QSGDistanceFieldGlyphCache *cache = m_distanceFieldCacheManager->cache(font); + QSGDistanceFieldGlyphCache *cache = m_glyphCaches.value(font, 0); if (!cache) { - cache = new QSGDefaultDistanceFieldGlyphCache(m_distanceFieldCacheManager, openglContext(), font); - m_distanceFieldCacheManager->insertCache(font, cache); + cache = new QSGDefaultDistanceFieldGlyphCache(openglContext(), font); + m_glyphCaches.insert(font, cache); } return cache; diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index 11c5444cd2..32eda2d142 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -39,7 +39,6 @@ #include "qsgdistancefieldglyphnode_p.h" #include "qsgdistancefieldglyphnode_p_p.h" -#include <QtQuick/private/qsgdistancefieldutil_p.h> #include <QtQuick/private/qsgcontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index 153f0a45c5..a67c659c99 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsgdistancefieldglyphnode_p_p.h" -#include <QtQuick/private/qsgdistancefieldutil_p.h> #include <QtQuick/private/qsgtexture_p.h> #include <QtGui/qopenglfunctions.h> #include <QtGui/qsurface.h> diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h index 04446c7b2c..7008f20925 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE class QSGRenderContext; -class QSGDistanceFieldGlyphCacheManager; class QSGDistanceFieldTextMaterial; class QSGDistanceFieldGlyphNode: public QSGGlyphNode, public QSGDistanceFieldGlyphConsumer { diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index 38c3b8dd85..c6db3df158 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -45,7 +45,6 @@ HEADERS += \ $$PWD/util/qsgtexture.h \ $$PWD/util/qsgtexture_p.h \ $$PWD/util/qsgtextureprovider.h \ - $$PWD/util/qsgdistancefieldutil_p.h \ $$PWD/util/qsgflatcolormaterial.h \ $$PWD/util/qsgsimplematerial.h \ $$PWD/util/qsgtexturematerial.h \ @@ -62,7 +61,6 @@ SOURCES += \ $$PWD/util/qsgsimpletexturenode.cpp \ $$PWD/util/qsgtexture.cpp \ $$PWD/util/qsgtextureprovider.cpp \ - $$PWD/util/qsgdistancefieldutil.cpp \ $$PWD/util/qsgflatcolormaterial.cpp \ $$PWD/util/qsgsimplematerial.cpp \ $$PWD/util/qsgtexturematerial.cpp \ diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp deleted file mode 100644 index 97a5853bd6..0000000000 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsgdistancefieldutil_p.h" - -#include <private/qsgadaptationlayer_p.h> -#if QT_CONFIG(opengl) -# include <QtGui/private/qopenglengineshadersource_p.h> -#endif -#include <QtQuick/private/qsgcontext_p.h> - -QT_BEGIN_NAMESPACE - -QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager() -{ -} - -QSGDistanceFieldGlyphCacheManager::~QSGDistanceFieldGlyphCacheManager() -{ - qDeleteAll(m_caches); -} - -QSGDistanceFieldGlyphCache *QSGDistanceFieldGlyphCacheManager::cache(const QRawFont &font) -{ - return m_caches.value(font, 0); -} - -void QSGDistanceFieldGlyphCacheManager::insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache) -{ - m_caches.insert(font, cache); -} - -QT_END_NAMESPACE diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h deleted file mode 100644 index 78e7ce15cd..0000000000 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSGDISTANCEFIELDUTIL_H -#define QSGDISTANCEFIELDUTIL_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qrawfont.h> -#include <private/qfontengine_p.h> -#include <private/qsgadaptationlayer_p.h> - -QT_BEGIN_NAMESPACE - -class QOpenGLShaderProgram; -class QSGDistanceFieldGlyphCache; -class QSGContext; - -class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCacheManager -{ -public: - QSGDistanceFieldGlyphCacheManager(); - ~QSGDistanceFieldGlyphCacheManager(); - - QSGDistanceFieldGlyphCache *cache(const QRawFont &font); - void insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache); - -private: - QHash<QRawFont, QSGDistanceFieldGlyphCache *> m_caches; -}; - -QT_END_NAMESPACE - -#endif // QSGDISTANCEFIELDUTIL_H |