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

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kolourpaint
From:       Clarence Dang <dang () kde ! org>
Date:       2007-10-18 7:35:31
Message-ID: 1192692931.337543.15977.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 726596 by dang:

kpSelection::setPixmap() should only emit "changed()" after all fields have
been recalculated -- including the transparency mask.

This unlikely to have any effect since usually, either
kpViewManager::setQueueUpdates() is active and/or
setFastUpdates() is _not _active (the latter uses QWidget::update()
which only causes a repaint when it re-renters the event loop, by
which time setPixmap() would have finished its work).

Nevertheless, this commit is important so that mysterious paint errors will
not occur after future code changes elsewhere.


 M  +3 -0      NEWS  
 M  +8 -8      kpselection.cpp  


--- branches/KDE/3.5/kdegraphics/kolourpaint/NEWS #726595:726596
@@ -4,6 +4,9 @@
 
 KolourPaint 1.4.9_relight (Frozen ???)
 
+   * Ensure selection operations always repaint correctly
+     [the effects of this change are unlikely to be functionality visible]
+
 KolourPaint 1.4.8_relight (Frozen 2007-10-08)
 
    * Always enable the paste actions to guarantee that pasting from
--- branches/KDE/3.5/kdegraphics/kolourpaint/kpselection.cpp #726595:726596
@@ -545,14 +545,12 @@
     //       it's a border, not a text box) but saves memory when using
     //       that kpSelection::setPixmap (QPixmap ()) hack.
     m_pixmap = pixmap.isNull () ? 0 : new QPixmap (pixmap);
+    QRect changedRect = boundingRect ();
 
-    QRect oldRect = boundingRect ();
-    emit changed (oldRect);
-
     if (m_pixmap)
     {
-        const bool changedSize = (m_pixmap->width () != oldRect.width () ||
-                                  m_pixmap->height () != oldRect.height ());
+        const bool changedSize = (m_pixmap->width () != m_rect.width () ||
+                                  m_pixmap->height () != m_rect.height ());
         const bool changedFromText = (m_type == Text);
         if (changedSize || changedFromText)
         {
@@ -560,8 +558,8 @@
             {
                 kdError () << "kpSelection::setPixmap() changes the size of the selection!"
                         << "   old:"
-                        << " w=" << oldRect.width ()
-                        << " h=" << oldRect.height ()
+                        << " w=" << m_rect.width ()
+                        << " h=" << m_rect.height ()
                         << "   new:"
                         << " w=" << m_pixmap->width ()
                         << " h=" << m_pixmap->height ()
@@ -580,11 +578,13 @@
 
             m_textLines = QValueVector <QString> ();
 
-            emit changed (boundingRect ());
+            changedRect = changedRect.unite (boundingRect ());
         }
     }
 
     calculateTransparencyMask ();
+
+    emit changed (changedRect);
 }
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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