src/hbcore/ovgeffects/hbvgframeeffect.cpp
changeset 5 627c4a0fd0e7
parent 0 16d8024aca5e
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    78  * coordinates and performs clipping to the device viewport.
    78  * coordinates and performs clipping to the device viewport.
    79  *
    79  *
    80  * \internal
    80  * \internal
    81  */
    81  */
    82 QRectF HbVgFrameEffectPrivate::deviceRectForSource(DeviceRectType type,
    82 QRectF HbVgFrameEffectPrivate::deviceRectForSource(DeviceRectType type,
    83                                                    QPaintDevice *pdev)
    83         QPaintDevice *pdev)
    84 {
    84 {
    85     Q_Q(HbVgFrameEffect);
    85     Q_Q(HbVgFrameEffect);
    86     QRectF br = type == IncludeChildren
    86     QRectF br = type == IncludeChildren
    87         ? q->sourceBoundingRectForRoot()
    87                 ? q->sourceBoundingRectForRoot()
    88         : q->sourceItemForRoot()->boundingRect();
    88                 : q->sourceItemForRoot()->boundingRect();
    89     QRect result = worldTransform.mapRect(br).toAlignedRect();
    89     QRect result = worldTransform.mapRect(br).toAlignedRect();
    90     if (pdev) {
    90     if (pdev) {
    91         int left, top, right, bottom;
    91         int left, top, right, bottom;
    92         result.getCoords(&left, &top, &right, &bottom);
    92         result.getCoords(&left, &top, &right, &bottom);
    93         if (left < 0)
    93         if (left < 0) {
    94             result.setX(0);
    94             result.setX(0);
    95         if (top < 0)
    95         }
       
    96         if (top < 0) {
    96             result.setY(0);
    97             result.setY(0);
       
    98         }
    97         int deviceWidth = pdev->width();
    99         int deviceWidth = pdev->width();
    98         int deviceHeight = pdev->height();
   100         int deviceHeight = pdev->height();
    99         if (right > deviceWidth - 1)
   101         if (right > deviceWidth - 1) {
   100             result.setRight(deviceWidth - 1);
   102             result.setRight(deviceWidth - 1);
   101         if (bottom > deviceHeight - 1)
   103         }
       
   104         if (bottom > deviceHeight - 1) {
   102             result.setBottom(deviceHeight - 1);
   105             result.setBottom(deviceHeight - 1);
       
   106         }
   103     }
   107     }
   104     return result;
   108     return result;
   105 }
   109 }
   106 
   110 
   107 HbVgFrameEffect::HbVgFrameEffect(QObject *parent)
   111 HbVgFrameEffect::HbVgFrameEffect(QObject *parent)
   125 }
   129 }
   126 
   130 
   127 void HbVgFrameEffect::setColor(const QColor &color)
   131 void HbVgFrameEffect::setColor(const QColor &color)
   128 {
   132 {
   129     Q_D(HbVgFrameEffect);
   133     Q_D(HbVgFrameEffect);
   130     if (d->color == color)
   134     if (d->color == color) {
   131         return;
   135         return;
       
   136     }
   132     d->color = color;
   137     d->color = color;
   133     updateEffect();
   138     updateEffect();
   134     emit colorChanged(color);
   139     emit colorChanged(color);
   135 }
   140 }
   136 
   141 
   157     Q_UNUSED(offset);
   162     Q_UNUSED(offset);
   158     Q_UNUSED(vgImage);
   163     Q_UNUSED(vgImage);
   159     Q_UNUSED(vgImageSize);
   164     Q_UNUSED(vgImageSize);
   160 
   165 
   161     Q_D(HbVgFrameEffect);
   166     Q_D(HbVgFrameEffect);
   162     if (d->hints & DrawSourceHint)
   167     if (d->hints & DrawSourceHint) {
   163         painter->drawPixmap(offset, d->srcPixmap);
   168         painter->drawPixmap(offset, d->srcPixmap);
       
   169     }
   164     painter->setOpacity(d->opacity);
   170     painter->setOpacity(d->opacity);
   165     painter->setPen(d->color);
   171     painter->setPen(d->color);
   166     painter->drawRect(d->deviceRectForSource(
   172     painter->drawRect(d->deviceRectForSource(
   167                           (d->hints & ExcludeChildrenHint)
   173                           (d->hints & ExcludeChildrenHint)
   168                           ? HbVgFrameEffectPrivate::ExcludeChildren
   174                           ? HbVgFrameEffectPrivate::ExcludeChildren