Don't tear down renderer and other busy work when Svg::setImagePath is invoked with the same arg
Summary: During my plasmashell startup this saves time for 17 calls. Opening something like Simple Menu saves another ~dozen. It's worth investigating why Svg::setImagePath gets called repeatedly with the same args to begin with, but this is worth doing anyway. Reviewers: #plasma, davidedmundson, mart Subscribers: plasma-devel, #frameworks Tags: #plasma, #frameworks Differential Revision: https://phabricator.kde.org/D9115
This commit is contained in:
parent
df09180d31
commit
4ce50cc61f
@ -103,6 +103,7 @@ public:
|
|||||||
QHash<QString, QRectF> localRectCache;
|
QHash<QString, QRectF> localRectCache;
|
||||||
QHash<QString, QSize> elementsWithSizeHints;
|
QHash<QString, QSize> elementsWithSizeHints;
|
||||||
SharedSvgRenderer::Ptr renderer;
|
SharedSvgRenderer::Ptr renderer;
|
||||||
|
QString requestedPath;
|
||||||
QString themePath;
|
QString themePath;
|
||||||
QString path;
|
QString path;
|
||||||
QSizeF size;
|
QSizeF size;
|
||||||
|
@ -182,6 +182,12 @@ QString SvgPrivate::cachePath(const QString &path, const QSize &size) const
|
|||||||
|
|
||||||
bool SvgPrivate::setImagePath(const QString &imagePath)
|
bool SvgPrivate::setImagePath(const QString &imagePath)
|
||||||
{
|
{
|
||||||
|
if (requestedPath == imagePath) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestedPath = imagePath;
|
||||||
|
|
||||||
QString actualPath = imagePath;
|
QString actualPath = imagePath;
|
||||||
if (imagePath.startsWith(QLatin1String("file://"))) {
|
if (imagePath.startsWith(QLatin1String("file://"))) {
|
||||||
//length of file://
|
//length of file://
|
||||||
|
Loading…
Reference in New Issue
Block a user