Optimize fontdatabase fallbacksForFamily
Short-cut the case-insensitive string comparison when lengths doesn't match. This reduces the time spend in ucstricmp from 8% during start-up of the textedit example, to under 1%. Change-Id: Ib3a92900b330453289ec9eff4830dfac6a9a5da2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
dc4c647137
commit
34be7dc9d0
|
|
@ -406,9 +406,14 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
|
|||
return foundries[count++];
|
||||
}
|
||||
|
||||
static inline bool equalsCaseInsensitive(const QString &a, const QString &b)
|
||||
{
|
||||
return a.size() == b.size() && a.compare(b, Qt::CaseInsensitive) == 0;
|
||||
}
|
||||
|
||||
bool QtFontFamily::matchesFamilyName(const QString &familyName) const
|
||||
{
|
||||
return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive);
|
||||
return equalsCaseInsensitive(name, familyName) || aliases.contains(familyName, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
void QtFontFamily::ensurePopulated()
|
||||
|
|
|
|||
Loading…
Reference in New Issue