equal
deleted
inserted
replaced
31 #include <QGraphicsScene> |
31 #include <QGraphicsScene> |
32 #include <QGraphicsItem> |
32 #include <QGraphicsItem> |
33 #include <QSet> |
33 #include <QSet> |
34 #include <hbmainwindow.h> |
34 #include <hbmainwindow.h> |
35 #include <hbmainwindow_p.h> |
35 #include <hbmainwindow_p.h> |
|
36 #include <hbinstance_p.h> |
36 |
37 |
37 /*! |
38 /*! |
38 * \class HbVgEffect |
39 * \class HbVgEffect |
39 * |
40 * |
40 * \brief Abstract base class for OpenVG effects. |
41 * \brief Abstract base class for OpenVG effects. |
102 rootEffect(0), |
103 rootEffect(0), |
103 sourceGraphicsItem(0), |
104 sourceGraphicsItem(0), |
104 mainWindow(0), |
105 mainWindow(0), |
105 lastUsedRotation(0), |
106 lastUsedRotation(0), |
106 lastRotationTransformAngle(0), |
107 lastRotationTransformAngle(0), |
107 forceSwMode(false) |
108 forceSwMode(false), |
|
109 alwaysClearPixmaps(true) // Enable it always for now, due to limited gpu memory. |
108 { |
110 { |
109 } |
111 } |
110 |
112 |
111 /*! |
113 /*! |
112 * \internal |
114 * \internal |
129 *pixmap = QPixmap(size); |
131 *pixmap = QPixmap(size); |
130 } |
132 } |
131 return qPixmapToVGImage(*pixmap); |
133 return qPixmapToVGImage(*pixmap); |
132 } |
134 } |
133 #endif |
135 #endif |
|
136 |
|
137 /*! |
|
138 * Clears all the pixmaps that live as member variables. This is not mandatory, |
|
139 * but helps reducing graphics memory usage. |
|
140 * |
|
141 * The downside is decreased performance due to new pixmap creation in the next |
|
142 * ensurePixmap() call. |
|
143 * |
|
144 * \internal |
|
145 */ |
|
146 void HbVgEffectPrivate::clearPixmaps() |
|
147 { |
|
148 // Note: If the effect used tryCache() then the underlying pixmap data for |
|
149 // dstPixmap will not really be destroyed here due to implicit sharing. |
|
150 srcPixmap = dstPixmap = tmpPixmap = QPixmap(); |
|
151 } |
134 |
152 |
135 /*! |
153 /*! |
136 * Invalidates the cache but only if it has not been done already. |
154 * Invalidates the cache but only if it has not been done already. |
137 * |
155 * |
138 * \internal |
156 * \internal |
473 // Leave raw VG mode. |
491 // Leave raw VG mode. |
474 painter->endNativePainting(); |
492 painter->endNativePainting(); |
475 |
493 |
476 // Restore the painter's previously set transformations. |
494 // Restore the painter's previously set transformations. |
477 painter->setWorldTransform(d->worldTransform); |
495 painter->setWorldTransform(d->worldTransform); |
|
496 |
|
497 // Make sure we don't keep any unused pixmaps alive in case the application |
|
498 // wants to minimize gpu memory usage (on the expense of performance). |
|
499 if (d->alwaysClearPixmaps || HbInstancePrivate::d_ptr()->mDropHiddenIconData) { |
|
500 d->clearPixmaps(); |
|
501 } |
478 |
502 |
479 #else |
503 #else |
480 // OpenVG code disabled => effect is not shown (but have the source drawn still). |
504 // OpenVG code disabled => effect is not shown (but have the source drawn still). |
481 drawSource(painter); |
505 drawSource(painter); |
482 #endif |
506 #endif |