[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeplasma-addons/applets/pastebin
From:       Artur Duque de Souza <morpheuz () gmail ! com>
Date:       2009-03-01 2:35:41
Message-ID: 1235874941.355419.17270.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 933489 by asouza:

Fix bug during icon painting: should use 254 as max opacity
otherwise it paints a black rectangle.

Also removed destructor comented code.


 M  +5 -16     pastebin.cpp  


--- trunk/KDE/kdeplasma-addons/applets/pastebin/pastebin.cpp #933488:933489
@@ -59,14 +59,7 @@
 
 Pastebin::~Pastebin()
 {
-    /*
-    delete m_displayEdit;
-    delete m_textServer;
-    delete m_imageServer;
-    delete m_graphicsWidget;
-    delete timer;
 
-    */
 }
 
 void Pastebin::setImageServer(int backend)
@@ -236,8 +229,7 @@
     p->setRenderHint(QPainter::Antialiasing);
 
     // Draw background
-    QColor bg = QColor("black");
-    bg.setAlphaF(m_alpha * 0.5);
+    QColor bg = QColor(0, 0, 0, m_alpha * 127);
 
     p->setBrush(bg);
     p->drawRect(contentsRect);
@@ -263,20 +255,17 @@
         QPainter painter;
         painter.begin(&pixmap);
 
+        painter.setCompositionMode(QPainter::CompositionMode_Source);
         painter.drawPixmap(QPoint(0,0), iconpix);
 
-        // For testing ...
-        //painter.setBrush(QColor("green"));
-        painter.drawRect(iconpix.rect());
-
         painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
-        painter.fillRect(iconpix.rect(), QColor(0, 0, 0, pix_alpha * 255));
+        painter.fillRect(iconpix.rect(), QColor(0, 0, 0, pix_alpha * 254));
         painter.end();
-        p->drawPixmap(iconOrigin, pixmap);
 
+        // draw the pixmap
+        p->drawPixmap(iconOrigin, pixmap);
     } else {
         // FIXME: Works, but makes hw acceleration impossible, use above code path
-        //kDebug() << "using setOpacity ..." << pix_alpha;
         qreal o = p->opacity();
         p->setOpacity(pix_alpha);
         p->drawPixmap(iconOrigin, iconpix);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic