QCoreTextFontEngine: Cache face_id.
This involves a significant amount of memory allocation, which made it rather more expensive than one would expect. The FT engine also caches face id, so this seems like a reasonable prospect. Increases delegates_text by another few ops/frame. Change-Id: If31e6b54478e4caf46a3a12a9ac45254a1f01525 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
parent
878cbbcb65
commit
571908f7fc
@ -162,6 +162,10 @@ void QCoreTextFontEngine::init()
|
|||||||
Q_ASSERT(ctfont != NULL);
|
Q_ASSERT(ctfont != NULL);
|
||||||
Q_ASSERT(cgFont != NULL);
|
Q_ASSERT(cgFont != NULL);
|
||||||
|
|
||||||
|
face_id.index = 0;
|
||||||
|
QCFString name = CTFontCopyName(ctfont, kCTFontUniqueNameKey);
|
||||||
|
face_id.filename = QCFString::toQString(name).toUtf8();
|
||||||
|
|
||||||
QCFString family = CTFontCopyFamilyName(ctfont);
|
QCFString family = CTFontCopyFamilyName(ctfont);
|
||||||
fontDef.family = family;
|
fontDef.family = family;
|
||||||
|
|
||||||
@ -696,13 +700,7 @@ void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shap
|
|||||||
|
|
||||||
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
|
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
|
||||||
{
|
{
|
||||||
FaceId result;
|
return face_id;
|
||||||
result.index = 0;
|
|
||||||
|
|
||||||
QCFString name = CTFontCopyName(ctfont, kCTFontUniqueNameKey);
|
|
||||||
result.filename = QCFString::toQString(name).toUtf8();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QCoreTextFontEngine::canRender(const QChar *string, int len) const
|
bool QCoreTextFontEngine::canRender(const QChar *string, int len) const
|
||||||
|
@ -135,6 +135,7 @@ private:
|
|||||||
int synthesisFlags;
|
int synthesisFlags;
|
||||||
CGAffineTransform transform;
|
CGAffineTransform transform;
|
||||||
QFixed avgCharWidth;
|
QFixed avgCharWidth;
|
||||||
|
QFontEngine::FaceId face_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
|
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user