Textures not scheduled for deletion while scrolling QML view.
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>
Thu, 26 May 2011 13:12:37 +0000 (15:12 +0200)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>
Thu, 26 May 2011 14:04:18 +0000 (16:04 +0200)
This happened when scrolling a view using an Image delegate (containing
QSGTexture). All textures were deleted at exit, but it is important to
immediately schedule the texture for deletion whenever the delegate is
destroyed to avoid unnecessary high memory consumption.

Task-number: QTBUG-19511
Reviewed-by: gunnar
src/declarative/util/qdeclarativepixmapcache.cpp

index fa3be22..f138741 100644 (file)
@@ -876,6 +876,10 @@ bool QDeclarativePixmapReply::event(QEvent *event)
 
 int QDeclarativePixmapData::cost() const
 {
+    if (texture) {
+        const QSize textureSize = texture->textureSize();
+        return textureSize.width() * textureSize.height();
+    }
     return (pixmap.width() * pixmap.height() * pixmap.depth()) / 8;
 }