diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 4886006..2fc1dbd 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1386,6 +1386,7 @@ QTextEngine::~QTextEngine() if (!stackEngine) delete layoutData; delete specialData; + resetFontEngineCache(); } const HB_CharAttributes *QTextEngine::attributes() const @@ -1446,6 +1447,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine) } } +void QTextEngine::resetFontEngineCache() +{ + releaseCachedFontEngine(feCache.prevFontEngine); + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.reset(); +} + void QTextEngine::invalidate() { freeMemory(); @@ -1454,9 +1462,7 @@ void QTextEngine::invalidate() if (specialData) specialData->resolvedFormatIndices.clear(); - releaseCachedFontEngine(feCache.prevFontEngine); - releaseCachedFontEngine(feCache.prevScaledFontEngine); - feCache.reset(); + resetFontEngineCache(); } void QTextEngine::clearLineData() diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 0a86886..067e81d 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -630,6 +630,8 @@ public: int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op); void insertionPointsForLine(int lineNum, QVector<int> &insertionPoints); + void resetFontEngineCache(); + private: void setBoundary(int strPos) const; void addRequiredBoundaries() const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 4595ef5..83c3676 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -375,7 +375,7 @@ QTextLayout::~QTextLayout() void QTextLayout::setFont(const QFont &font) { d->fnt = font; - d->feCache.reset(); + d->resetFontEngineCache(); } /*! @@ -515,7 +515,7 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList) } if (d->block.docHandle()) d->block.docHandle()->documentChange(d->block.position(), d->block.length()); - d->feCache.reset(); + d->resetFontEngineCache(); } /*! |