summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-06-02 11:07:21 +1000
committerMichael Brasser <michael.brasser@nokia.com>2011-06-02 11:30:33 +1000
commit5b1a0a5564a69331d581bcf4f94da0e11d14a31f (patch)
tree65bc07746484f1aa24c23e1e63057cf65deb3fc3 /src/declarative/util
parentf8d71ee8c5f29eabb759ff4b0d5c8a153023a254 (diff)
Add private method for flushing the pixmap cache.
Change-Id: I7330383b89a3a313dd845274d17d38c714db20ce Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp14
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index a29854fa84..831aa75070 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -584,6 +584,7 @@ public:
void unreferencePixmap(QDeclarativePixmapData *);
void referencePixmap(QDeclarativePixmapData *);
+ void flushCache();
protected:
virtual void timerEvent(QTimerEvent *);
@@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *)
}
}
+/*
+ Remove all unreferenced pixmaps from the cache.
+*/
+void QDeclarativePixmapStore::flushCache()
+{
+ shrinkCache(m_unreferencedCost);
+}
+
QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d)
: data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0)
{
@@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method)
return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method);
}
+void QDeclarativePixmap::flushCache()
+{
+ pixmapStore()->flushCache();
+}
+
QT_END_NAMESPACE
#include <qdeclarativepixmapcache.moc>
diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index 1cf76dda71..48c9f8b2d1 100644
--- a/src/declarative/util/qdeclarativepixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -103,6 +103,8 @@ public:
bool connectDownloadProgress(QObject *, const char *);
bool connectDownloadProgress(QObject *, int);
+ static void flushCache();
+
private:
Q_DISABLE_COPY(QDeclarativePixmap)
QDeclarativePixmapData *d;