src/hbcore/image/hbpixmapiconrenderer.cpp
changeset 5 627c4a0fd0e7
parent 1 f7ac710697a9
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbcore/image/hbpixmapiconrenderer.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbcore/image/hbpixmapiconrenderer.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -29,16 +29,15 @@
 #include <QStyleOption>
 #include <QApplication>
 
-struct HbPixmapIconMaskedData
-{
+struct HbPixmapIconMaskedData {
     QPixmap    currentPixmap;
 };
 
 HbPixmapIconRenderer::HbPixmapIconRenderer(const QPixmap &pixmap, HbIconImpl *impl)
-        : iconMode(QIcon::Normal),
-        iconPropertiesApplied(false),
-        pixmapData(pixmap),
-        iconImpl(impl)
+    : iconMode(QIcon::Normal),
+      iconPropertiesApplied(false),
+      pixmapData(pixmap),
+      iconImpl(impl)
 {
 }
 
@@ -46,10 +45,10 @@
 {
 }
 
-void HbPixmapIconRenderer::draw(QPainter* painter,
+void HbPixmapIconRenderer::draw(QPainter *painter,
                                 const QPointF &topLeft,
                                 const QPainterPath &clipPath,
-                                HbMaskableIconImpl * maskIconData)
+                                HbMaskableIconImpl *maskIconData)
 {
     if (!iconPropertiesApplied) {
         applyIconProperties();
@@ -67,37 +66,33 @@
     doDraw(painter, topLeft, pixmapToDraw, clipPath);
 }
 
-void HbPixmapIconRenderer::doDraw(QPainter * painter,
-                                  const QPointF & topLeft,
-                                  const QPixmap & finalPixmap,
-                                  const QPainterPath & clipPath)
+void HbPixmapIconRenderer::doDraw(QPainter *painter,
+                                  const QPointF &topLeft,
+                                  const QPixmap &finalPixmap,
+                                  const QPainterPath &clipPath)
 {
     if (!clipPath.isEmpty()) {
         QPainterPath oldPath;
-        bool clipped = painter->hasClipping();
-    
-        if (!clipped) {
+        bool wasClipped = painter->hasClipping();
+
+        if (!wasClipped) {
             painter->setClipping(true);
         }
-        
+
         QRectF cliprect = clipPath.boundingRect();
         QPainterPath intersect(clipPath);
-        if (clipped) {
-            oldPath = painter->clipPath();
+        oldPath = painter->clipPath();
+        if (wasClipped) {
             QRectF oldrect = oldPath.boundingRect();
             intersect =  oldPath.intersected(clipPath);
             QRectF interrect = intersect.boundingRect();
         }
-    
-        painter->setClipPath(intersect, Qt::ReplaceClip);     
+
+        painter->setClipPath(intersect, Qt::ReplaceClip);
         painter->drawPixmap(topLeft, finalPixmap);
-    
-        if (!clipped) {
-            painter->setClipPath(oldPath, Qt::NoClip);
-        } else {
-            painter->setClipPath(oldPath);
-        }
-        painter->setClipping(clipped);
+
+        painter->setClipPath(oldPath);
+        painter->setClipping(wasClipped);
     }  else {
         painter->drawPixmap(topLeft, finalPixmap);
     }
@@ -122,11 +117,11 @@
     iconPropertiesApplied = true;
 }
 
-QPixmap HbPixmapIconRenderer::getMaskedPixmap(HbMaskableIconImpl * maskIconData)
+QPixmap HbPixmapIconRenderer::getMaskedPixmap(HbMaskableIconImpl *maskIconData)
 {
     QPixmap maskedPixmap;
 
-    HbPixmapIconMaskedData * mi = (HbPixmapIconMaskedData *)maskIconData->implData();
+    HbPixmapIconMaskedData *mi = (HbPixmapIconMaskedData *)maskIconData->implData();
     if (maskIconData->maskChanged()) {
         if (!mi) {
             mi = new HbPixmapIconMaskedData();
@@ -146,6 +141,6 @@
 
 void HbPixmapIconRenderer::destroyMaskedData(HbIconMaskedData *data)
 {
-    delete((HbPixmapIconMaskedData*)data);
+    delete((HbPixmapIconMaskedData *)data);
 }