initialize the natural size also for absolute path svgs
never insert the whole image (no element) in the invalid list to backport or not to backport? CCMAIL plasma-devel@kde.org svn path=/trunk/KDE/kdelibs/; revision=915328
This commit is contained in:
parent
2836267745
commit
c532c9fda5
14
svg.cpp
14
svg.cpp
@ -140,20 +140,24 @@ class SvgPrivate
|
|||||||
q, SLOT(colorsChanged()));
|
q, SLOT(colorsChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (QFile::exists(imagePath)) {
|
||||||
|
path = imagePath;
|
||||||
|
} else {
|
||||||
|
kDebug() << "file '" << path << "' does not exist!";
|
||||||
|
}
|
||||||
|
|
||||||
|
//also images with absolute path needs to have a natural size initialized, even if looks a bit weird using Theme to store non-themed stuff
|
||||||
|
if (themed || QFile::exists(imagePath)) {
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
bool found = Theme::defaultTheme()->findInRectsCache(path, "_Natural", rect);
|
bool found = Theme::defaultTheme()->findInRectsCache(path, "_Natural", rect);
|
||||||
|
|
||||||
if (found && !rect.isValid()) {
|
if (!found) {
|
||||||
createRenderer();
|
createRenderer();
|
||||||
naturalSize = renderer->defaultSize();
|
naturalSize = renderer->defaultSize();
|
||||||
Theme::defaultTheme()->insertIntoRectsCache(path, "_Natural", QRectF(QPointF(0,0), naturalSize));
|
Theme::defaultTheme()->insertIntoRectsCache(path, "_Natural", QRectF(QPointF(0,0), naturalSize));
|
||||||
} else {
|
} else {
|
||||||
naturalSize = rect.size();
|
naturalSize = rect.size();
|
||||||
}
|
}
|
||||||
} else if (QFile::exists(imagePath)) {
|
|
||||||
path = imagePath;
|
|
||||||
} else {
|
|
||||||
kDebug() << "file '" << path << "' does not exist!";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateNeeded;
|
return updateNeeded;
|
||||||
|
@ -585,6 +585,12 @@ bool Theme::findInRectsCache(const QString &image, const QString &element, QRect
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//A single _ means the element is empty and we're asked for the size of
|
||||||
|
//the whole image, so the whole image is never invalid
|
||||||
|
if (element.count('_') == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool invalid = false;
|
bool invalid = false;
|
||||||
|
|
||||||
QHash<QString, QSet<QString> >::iterator it = d->invalidElements.find(image);
|
QHash<QString, QSet<QString> >::iterator it = d->invalidElements.find(image);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user