QWindowsFontDatabase: avoid multiple map lookups
Use the iterator-based API, and avoid a quadruple (!) lookup into a QMap. I'm aggressively cherry-picking to avoid merge clashes with an upcoming fix. Pick-to: 6.2 6.5 6.6 Change-Id: I05968f4aec9e42f84f909a1103e43ba323a9544f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
284b1a5661
commit
2bc475f94e
@ -1107,18 +1107,20 @@ bool QWindowsFontDatabase::fontsAlwaysScalable() const
|
||||
|
||||
void QWindowsFontDatabase::derefUniqueFont(const QString &uniqueFont)
|
||||
{
|
||||
if (m_uniqueFontData.contains(uniqueFont)) {
|
||||
if (!m_uniqueFontData[uniqueFont].refCount.deref()) {
|
||||
RemoveFontMemResourceEx(m_uniqueFontData[uniqueFont].handle);
|
||||
m_uniqueFontData.remove(uniqueFont);
|
||||
const auto it = m_uniqueFontData.find(uniqueFont);
|
||||
if (it != m_uniqueFontData.end()) {
|
||||
if (!it->refCount.deref()) {
|
||||
RemoveFontMemResourceEx(it->handle);
|
||||
m_uniqueFontData.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont)
|
||||
{
|
||||
if (m_uniqueFontData.contains(uniqueFont))
|
||||
m_uniqueFontData[uniqueFont].refCount.ref();
|
||||
const auto it = m_uniqueFontData.find(uniqueFont);
|
||||
if (it != m_uniqueFontData.end())
|
||||
it->refCount.ref();
|
||||
}
|
||||
|
||||
QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
|
||||
|
Loading…
Reference in New Issue
Block a user