clear the local cache on resize; prevent ever growing memory usage due to the cache and looking through our applet code people tend to resize rarely, and not between paints

svn path=/trunk/KDE/kdelibs/; revision=891373
This commit is contained in:
Aaron J. Seigo 2008-12-01 21:10:33 +00:00
parent ab56a3a388
commit 613383b1ea

17
svg.cpp
View File

@ -442,16 +442,27 @@ void Svg::resize(qreal width, qreal height)
void Svg::resize(const QSizeF &size) void Svg::resize(const QSizeF &size)
{ {
if (qFuzzyCompare(size, d->size)) {
return;
}
d->size = size; d->size = size;
d->localRectCache.clear();
} }
void Svg::resize() void Svg::resize()
{ {
QSizeF newSize;
if (d->renderer) { if (d->renderer) {
d->size = d->renderer->defaultSize(); newSize = d->renderer->defaultSize();
} else {
d->size = QSizeF();
} }
if (qFuzzyCompare(newSize, d->size)) {
return;
}
d->size = newSize;
d->localRectCache.clear();
} }
QSize Svg::elementSize(const QString &elementId) const QSize Svg::elementSize(const QString &elementId) const