--- a/src/hbcore/ovgeffects/hbvgeffect.cpp Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/ovgeffects/hbvgeffect.cpp Mon Oct 04 00:38:12 2010 +0300
@@ -33,6 +33,7 @@
#include <QSet>
#include <hbmainwindow.h>
#include <hbmainwindow_p.h>
+#include <hbinstance_p.h>
/*!
* \class HbVgEffect
@@ -104,7 +105,8 @@
mainWindow(0),
lastUsedRotation(0),
lastRotationTransformAngle(0),
- forceSwMode(false)
+ forceSwMode(false),
+ alwaysClearPixmaps(true) // Enable it always for now, due to limited gpu memory.
{
}
@@ -133,6 +135,22 @@
#endif
/*!
+ * Clears all the pixmaps that live as member variables. This is not mandatory,
+ * but helps reducing graphics memory usage.
+ *
+ * The downside is decreased performance due to new pixmap creation in the next
+ * ensurePixmap() call.
+ *
+ * \internal
+ */
+void HbVgEffectPrivate::clearPixmaps()
+{
+ // Note: If the effect used tryCache() then the underlying pixmap data for
+ // dstPixmap will not really be destroyed here due to implicit sharing.
+ srcPixmap = dstPixmap = tmpPixmap = QPixmap();
+}
+
+/*!
* Invalidates the cache but only if it has not been done already.
*
* \internal
@@ -476,6 +494,12 @@
// Restore the painter's previously set transformations.
painter->setWorldTransform(d->worldTransform);
+ // Make sure we don't keep any unused pixmaps alive in case the application
+ // wants to minimize gpu memory usage (on the expense of performance).
+ if (d->alwaysClearPixmaps || HbInstancePrivate::d_ptr()->mDropHiddenIconData) {
+ d->clearPixmaps();
+ }
+
#else
// OpenVG code disabled => effect is not shown (but have the source drawn still).
drawSource(painter);