const auto svgName = QString::fromLatin1(":/client/theme/%1/%2.svg").arg(flavor).arg(name);
QSvgRenderer renderer(svgName);
-
- const auto sizes = isBranded() ? QVector<int>{ 16, 22, 32, 48, 64, 128, 256, 512, 1024 }
- : QVector<int>{ 16, 32, 64, 128, 256 };
- for (int size : sizes) {
+ const auto createPixmapFromSvg = [&renderer] (int size) {
QImage img(size, size, QImage::Format_ARGB32);
img.fill(Qt::GlobalColor::transparent);
QPainter imgPainter(&img);
renderer.render(&imgPainter);
- auto px = QPixmap::fromImage(img);
+ return QPixmap::fromImage(img);
+ };
+
+ const auto sizes = isBranded() ? QVector<int>{ 16, 22, 32, 48, 64, 128, 256, 512, 1024 }
+ : QVector<int>{ 16, 32, 64, 128, 256 };
+ for (int size : sizes) {
+ auto px = createPixmapFromSvg(size);
// HACK, get rid of it by supporting FDO icon themes, this is really just emulating ubuntu-mono
if (qgetenv("DESKTOP_SESSION") == "ubuntu") {
QBitmap mask = px.createMaskFromColor(Qt::white, Qt::MaskOutColor);