src/hbcore/ovgeffects/hbvgeffect.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 30 80e4d18b72f5
--- a/src/hbcore/ovgeffects/hbvgeffect.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbcore/ovgeffects/hbvgeffect.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -398,10 +398,19 @@
  * world transform is not reset before calling this, in contrast to
  * performEffect(). (this means that neither d->srcPixmap nor
  * d->worldTransform is available).
+ *
+ * If the effect is able to render itself into a pixmap then it should do so
+ * when \a result and \a resultPos are not 0. In this case the effect should not
+ * paint anything onto \a devicePainter but all its output should go into a
+ * newly created pixmap starting at position (0, 0). This pixmap is then
+ * returned to the caller in \a result. The offset that will be needed when
+ * painting the pixmap onto the devicePainter is passed back in \a resultPos.
  */
-void HbVgEffect::performEffectSw(QPainter *painter)
+void HbVgEffect::performEffectSw(QPainter *devicePainter, QPixmap *result, QPointF *resultPos)
 {
-    drawSource(painter);
+    Q_UNUSED(result);
+    Q_UNUSED(resultPos);
+    drawSource(devicePainter);
 }
 
 /*!
@@ -428,7 +437,7 @@
     if (d->forceSwMode || !paintEngine || paintEngine->type() != QPaintEngine::OpenVG) {
         // No sourcePixmap() and world transform change here because
         // in most cases we will just call drawSource().
-        performEffectSw(painter);
+        performEffectSw(painter, 0, 0);
         d->paramsChanged = d->cacheInvalidated = false;
         return;
     }
@@ -620,6 +629,18 @@
 }
 
 /*!
+ * Calls sourcePixmap() for this effect, or, in case of chained effects, for the
+ * root of the chain.
+ */
+QPixmap HbVgEffect::sourcePixmapForRoot(Qt::CoordinateSystem system, QPoint *offset)
+{
+    Q_D(HbVgEffect);
+    return d->rootEffect
+        ? d->rootEffect->sourcePixmapForRoot(system, offset)
+        : sourcePixmap(system, offset);
+}
+
+/*!
  * Installs the effect on a given graphics item. This is merely a wrapper to
  * QGraphicsItem::setGraphicsEffect(). To uninstall the effect use
  * setGraphicsEffect in the usual way (i.e. pass null). This function will do
@@ -637,3 +658,13 @@
         item->setGraphicsEffect(this);
     }
 }
+
+/*!
+ * A sw-based mask effect should return ChainBehavAsSource. Anything else should
+ * stick to the default ChainBehavNormal. There can only be 0 or 1 effect with
+ * ChainBehavAsSource in a chain.
+ */
+HbVgEffect::ChainBehavior HbVgEffect::chainBehavior() const
+{
+    return ChainBehavNormal;
+}