diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2016-11-11 15:35:02 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2016-11-18 12:41:31 +0000 |
commit | 5ffd0d8be35cea57acbf1e8d7a740d3fab5cbe43 (patch) | |
tree | 07dd399bdbfa65b387c0e0f56e243fc4297571c9 /src/quick/items/qquicktextnode.cpp | |
parent | 1969991c4a4bd39ee224b0fa3c8cffa51f061757 (diff) |
Text: Make use of the new cached isSmoothlyScaled attribute on QFontEngine
Relies on qtbase/f2205c48c21a6b135f2f59d0cf46e72f90f9f0f4.
Asking QFontDatabase whether or not the font can be smoothly scaled is expensive
Now that the attribute is available on QFontEngine, we can bypass all that.
Benchmark results from qmlbench on creation/delegates_text on a 2011 mbp.
Before: Average: 173.2 ops/frame; using 5/5 samples; MedianAll=173; StdDev=1.94, CoV=0.0112 - StdDev (all samples included)=1.94
After: Average: 180.8 ops/frame; using 5/5 samples; MedianAll=182; StdDev=1.94, CoV=0.0107 - StdDev (all samples included)=1.94
Change-Id: I56efd903037a29ee014de0cbf482cfbef7fce494
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquicktextnode.cpp')
-rw-r--r-- | src/quick/items/qquicktextnode.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index 2c7ab254f8..f91c8de634 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -93,10 +93,12 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun bool preferNativeGlyphNode = m_useNativeRenderer; if (!preferNativeGlyphNode) { QRawFontPrivate *fontPriv = QRawFontPrivate::get(font); - if (fontPriv->fontEngine->hasUnreliableGlyphOutline()) + if (fontPriv->fontEngine->hasUnreliableGlyphOutline()) { preferNativeGlyphNode = true; - else - preferNativeGlyphNode = !QFontDatabase().isSmoothlyScalable(font.familyName(), font.styleName()); + } else { + QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine; + preferNativeGlyphNode = !fe->isSmoothlyScalable; + } } QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode); |