# HG changeset patch # User Chris Cannam # Date 1430905459 -3600 # Node ID 85b39667e9cf544206c3f68bd14692678770656c # Parent 4b5efd76a55c814ba830ed694ae0886eb7a148b8 Various fixes to scalable rendering diff -r 4b5efd76a55c -r 85b39667e9cf widgets/IconLoader.cpp --- a/widgets/IconLoader.cpp Wed May 06 10:08:28 2015 +0100 +++ b/widgets/IconLoader.cpp Wed May 06 10:44:19 2015 +0100 @@ -92,26 +92,33 @@ IconLoader::loadPixmap(QString name, int size) { bool invert = shouldInvert(); -/* - QString nonScalableName = makeNonScalableFilename(name, size, invert); - QPixmap pmap(nonScalableName); + + QString scalableName, nonScalableName; + QPixmap pmap; + + nonScalableName = makeNonScalableFilename(name, size, invert); + pmap = QPixmap(nonScalableName); if (!pmap.isNull()) return pmap; -*/ - QString scalableName = makeScalableFilename(name, invert); - QPixmap pmap = loadScalable(scalableName, size); - if (!pmap.isNull()) return pmap; - /* + + if (size > 0) { + scalableName = makeScalableFilename(name, invert); + pmap = loadScalable(scalableName, size); + if (!pmap.isNull()) return pmap; + } + if (invert && shouldAutoInvert(name)) { nonScalableName = makeNonScalableFilename(name, size, false); pmap = QPixmap(nonScalableName); if (!pmap.isNull()) return invertPixmap(pmap); - scalableName = makeScalableFilename(name, false); - pmap = loadScalable(scalableName, size); - if (!pmap.isNull()) return invertPixmap(pmap); + if (size > 0) { + scalableName = makeScalableFilename(name, false); + pmap = loadScalable(scalableName, size); + if (!pmap.isNull()) return invertPixmap(pmap); + } } - */ + return QPixmap(); } @@ -124,9 +131,13 @@ } QPixmap pmap(size, size); pmap.fill(Qt::transparent); - QPainter painter(&pmap); QSvgRenderer renderer(name); + QPainter painter; + painter.begin(&pmap); + cerr << "calling renderer for " << name << " at size " << size << "..." << endl; renderer.render(&painter); + cerr << "renderer completed" << endl; + painter.end(); return pmap; }