aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2016-12-02 11:19:48 +0100
committerAndy Nichols <andy.nichols@qt.io>2016-12-13 15:43:28 +0000
commit4cdeeea8e2fd90b984c49edeb3765d2079487d79 (patch)
treed7ae6fb0b899a0c14f02c75256b9b039aa75e9ef /src/plugins
parent0119439c9d25dfd892bbee47068e9d726f4bff97 (diff)
OpenVG: Use QRawFont qHash function in font cache
A qHash function was added for QRawFont, so use that instead of our own. Change-Id: Iad8deb8a0e2a727039ec752e38e42cef2127735c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.cpp27
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h4
2 files changed, 3 insertions, 28 deletions
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.cpp b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.cpp
index 1ed54f7b6a..dd630c776f 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.cpp
@@ -56,37 +56,14 @@ QSGOpenVGFontGlyphCacheManager::~QSGOpenVGFontGlyphCacheManager()
QSGOpenVGFontGlyphCache *QSGOpenVGFontGlyphCacheManager::cache(const QRawFont &font)
{
- return m_caches.value(fontKey(font), nullptr);
+ return m_caches.value(font, nullptr);
}
void QSGOpenVGFontGlyphCacheManager::insertCache(const QRawFont &font, QSGOpenVGFontGlyphCache *cache)
{
- m_caches.insert(fontKey(font), cache);
+ m_caches.insert(font, cache);
}
-QString QSGOpenVGFontGlyphCacheManager::fontKey(const QRawFont &font)
-{
- QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine;
- if (!fe->faceId().filename.isEmpty()) {
- QByteArray keyName = fe->faceId().filename;
- if (font.style() != QFont::StyleNormal)
- keyName += QByteArray(" I");
- if (font.weight() != QFont::Normal)
- keyName += ' ' + QByteArray::number(font.weight());
- keyName += " " + QString::number(font.pixelSize());
- keyName += QByteArray(" DF");
- return QString::fromUtf8(keyName);
- } else {
- return QString::fromLatin1("%1_%2_%3_%4_%5")
- .arg(font.familyName())
- .arg(font.styleName())
- .arg(font.weight())
- .arg(font.style())
- .arg(font.pixelSize());
- }
-}
-
-
QSGOpenVGFontGlyphCache::QSGOpenVGFontGlyphCache(QSGOpenVGFontGlyphCacheManager *manager, const QRawFont &font)
: m_manager(manager)
{
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h
index a4a51cd2b6..a88d28b0fe 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h
+++ b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h
@@ -59,9 +59,7 @@ public:
void insertCache(const QRawFont &font, QSGOpenVGFontGlyphCache *cache);
private:
- static QString fontKey(const QRawFont &font);
-
- QHash<QString, QSGOpenVGFontGlyphCache *> m_caches;
+ QHash<QRawFont, QSGOpenVGFontGlyphCache *> m_caches;
};
class QSGOpenVGFontGlyphCache