diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-13 22:06:48 +0100 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-02-15 03:49:46 +0000 |
commit | ce86d7385090746c3baf2991dd1cacb911ff6d88 (patch) | |
tree | 72e0b72e624cf98206c1791d71c208a6246b9fc8 /src | |
parent | 5a23fcfa8a303d6bd796b35d9a914a2ca4005f99 (diff) |
QFontDatabase: Move style key near usage to avoid heap allocs
Raises delegates_text.qml to 233 ops/frame
Change-Id: I88a26d2a9e4dc12ebbbc07329141976c194555ec
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 127a2efa8c..211b8b6659 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1570,11 +1570,10 @@ bool QFontDatabase::isBitmapScalable(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(style); - QtFontFamily *f = d->family(familyName); if (!f) return bitmapScalable; + QtFontStyle::Key styleKey(style); for (int j = 0; j < f->count; j++) { QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { @@ -1614,8 +1613,6 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(style); - QtFontFamily *f = d->family(familyName); if (!f) { for (int i = 0; i < d->count; i++) { @@ -1628,6 +1625,7 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty } if (!f) return smoothScalable; + QtFontStyle::Key styleKey(style); for (int j = 0; j < f->count; j++) { QtFontFoundry *foundry = f->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { @@ -1680,8 +1678,6 @@ QList<int> QFontDatabase::pointSizes(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(styleName); - QList<int> sizes; QtFontFamily *fam = d->family(familyName); @@ -1690,6 +1686,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family, const int dpi = qt_defaultDpiY(); // embedded + QtFontStyle::Key styleKey(styleName); for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { @@ -1783,8 +1780,6 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); - QtFontStyle::Key styleKey(styleName); - QList<int> sizes; QtFontFamily *fam = d->family(familyName); @@ -1793,6 +1788,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, const int dpi = qt_defaultDpiY(); // embedded + QtFontStyle::Key styleKey(styleName); for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { |