From: Kevin Ottens Date: Thu, 23 Jul 2020 17:04:26 +0000 (+0200) Subject: Extract the svg renderer from the loop X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~45^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=73c3aa78984398f4c47126735e6bf8a60297b848;p=nextcloud-desktop.git Extract the svg renderer from the loop No need to recreate it each time for nothing. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 8274e1580..50e5de836 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -144,11 +144,12 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray) const return cached = QIcon::fromTheme(name); } + const auto svgName = QString::fromLatin1(":/client/theme/%1/%2.svg").arg(flavor).arg(name); + QSvgRenderer renderer(svgName); + const auto sizes = isBranded() ? QVector{ 16, 22, 32, 48, 64, 128, 256, 512, 1024 } : QVector{ 16, 32, 64, 128, 256 }; for (int size : sizes) { - QString svgName = QString::fromLatin1(":/client/theme/%1/%2.svg").arg(flavor).arg(name); - QSvgRenderer renderer(svgName); QImage img(size, size, QImage::Format_ARGB32); img.fill(Qt::GlobalColor::transparent); QPainter imgPainter(&img);