QFusionStyle: optimize cache-key generation for qt_fusion_draw_button():

Instead of passing a QLatin1StringView to QStyleHelper::uniqueName(),
which takes a QString, allocating, and then using QStringBuilder to
append something to the result of uniqueHelper(), allocating again,
pull the appends to before the call to uniqueName(), folding these two
allocations into one.

Task-number: QTBUG-112200
Change-Id: I501dd4a3df4b9f5267ca931b550d521f4dafe493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 362b5b84281ac4f31237166763f565e331876887)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-06-05 11:01:28 +02:00 committed by Qt Cherry-pick Bot
parent a95930282e
commit 010b9adb95

View File

@ -224,9 +224,10 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
const int size = qMin(arrowMax, rectMax); const int size = qMin(arrowMax, rectMax);
QPixmap cachePixmap; QPixmap cachePixmap;
QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1, option, rect.size()) const QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1
% HexString<uint>(type) % HexString<uint>(type)
% HexString<uint>(color.rgba()); % HexString<uint>(color.rgba()),
option, rect.size());
if (!QPixmapCache::find(cacheKey, &cachePixmap)) { if (!QPixmapCache::find(cacheKey, &cachePixmap)) {
cachePixmap = styleCachePixmap(rect.size()); cachePixmap = styleCachePixmap(rect.size());
cachePixmap.fill(Qt::transparent); cachePixmap.fill(Qt::transparent);