remove all the cached pixmaps when the cache is cleared.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=776939
This commit is contained in:
parent
2954087e8d
commit
2e07ca5f64
19
svg.cpp
19
svg.cpp
@ -94,23 +94,25 @@ class Svg::Private
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeFromCache()
|
void removeFromCache() {
|
||||||
{
|
if (ids.isEmpty()) {
|
||||||
if ( id.isEmpty() ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmapCache::remove( id );
|
foreach (const QString & id, ids) {
|
||||||
id.clear();
|
QPixmapCache::remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
ids.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void findInCache(QPixmap& p, const QString& elementId)
|
void findInCache(QPixmap& p, const QString& elementId)
|
||||||
{
|
{
|
||||||
createRenderer();
|
createRenderer();
|
||||||
id = QString::fromLatin1("%3_%2_%1")
|
QString id = QString::fromLatin1("%3_%2_%1_").arg(size.width())
|
||||||
.arg(size.width())
|
|
||||||
.arg(size.height())
|
.arg(size.height())
|
||||||
.arg(path);
|
.arg(path);
|
||||||
|
|
||||||
if (!elementId.isEmpty()) {
|
if (!elementId.isEmpty()) {
|
||||||
id.append(elementId);
|
id.append(elementId);
|
||||||
}
|
}
|
||||||
@ -123,6 +125,7 @@ class Svg::Private
|
|||||||
//kDebug() << "didn't find cached version of " << id << ", so re-rendering";
|
//kDebug() << "didn't find cached version of " << id << ", so re-rendering";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ids.append(id);
|
||||||
// we have to re-render this puppy
|
// we have to re-render this puppy
|
||||||
QSize s;
|
QSize s;
|
||||||
if (elementId.isEmpty() || contentType == Svg::ImageSet) {
|
if (elementId.isEmpty() || contentType == Svg::ImageSet) {
|
||||||
@ -216,7 +219,7 @@ class Svg::Private
|
|||||||
SharedSvgRenderer::Ptr renderer;
|
SharedSvgRenderer::Ptr renderer;
|
||||||
QString themePath;
|
QString themePath;
|
||||||
QString path;
|
QString path;
|
||||||
QString id;
|
QList<QString> ids;
|
||||||
QSizeF size;
|
QSizeF size;
|
||||||
bool themed;
|
bool themed;
|
||||||
Svg::ContentType contentType;
|
Svg::ContentType contentType;
|
||||||
|
Loading…
Reference in New Issue
Block a user