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

List:       koffice-devel
Subject:    [Patch] KWord: Only repaint at grid positions
From:       Sven =?iso-8859-1?q?L=FCppken?= <Sven.Lueppken () gutenberg-project ! org>
Date:       2001-07-25 18:33:10
[Download RAW message or body]

Hi!

I created a patch which fixes bug #29209 :

"When rescaling or moving a picture on every mouse event the pic is redrawed,
the pic is only moved at grid positions, only redraw there as well..."

I added two tests which compare the new with the old coordinates and the pic 
is only repainted if they're different!

Please review! If the patch is ok I'll commit it :))

Regards,
-- 
Sven Lüppken, KDE / KOffice Developer
Sven.Lueppken@gutenberg-project.org
Conquer your Desktop with KDE!

["kwcanvas.diff" (text/x-diff)]

Index: kwcanvas.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwcanvas.cc,v
retrieving revision 1.270
diff -u -b -r1.270 kwcanvas.cc
--- kwcanvas.cc	2001/07/24 16:40:11	1.270
+++ kwcanvas.cc	2001/07/25 18:23:04
@@ -640,9 +640,9 @@
               )
         {
             double resizedFrameRatio = m_resizedFrameInitialSize.width() / \
                m_resizedFrameInitialSize.height();
-
             double width = newRight - newLeft;
             double height = newBottom - newTop;
+
             if ( ( top || bottom ) && ( left || right ) ) // resizing by a corner
                 if ( width < height )
                     width = height * resizedFrameRatio;
@@ -665,6 +665,9 @@
             //kdDebug() << "KWCanvas::mmEditFrameResize after: newRight=" << \
newRight << " newBottom=" << newBottom << endl;  }
     }
+    // Check if frame was really resized because otherwise no repaint is needed
+    if( newLeft != frame->left() || newRight != frame->right() || newTop != \
frame->top() || newBottom != frame->bottom() ) +    {
     // Keep copy of old rectangle, for repaint()
     QRect oldRect = m_viewMode->normalToView( frame->outerRect() );
 
@@ -686,7 +689,7 @@
 
     //kdDebug() << "KWCanvas::mmEditFrameResize new rect " << DEBUGRECT( *frame ) << \
endl;  
-#if 0
+        #if 0
     int drawX, drawWidth, drawY, drawHeight;
     drawX=frame->left();
     drawWidth=frame->width();
@@ -703,7 +706,7 @@
     }
     //p.drawRect( drawX, drawY, drawWidth, drawHeight );
     //p.end();
-#endif
+        #endif
 
     // Move resize handles to new position
     frame->updateResizeHandles();
@@ -714,6 +717,7 @@
     m_frameResized = true;
 
     m_gui->getView()->updateFrameStatusBarItem();
+    }
 }
 
 void KWCanvas::applyGrid( KoPoint &p )
@@ -829,6 +833,7 @@
         for ( ; frameIt.current(); ++frameIt )
         {
             KWFrame *frame = frameIt.current();
+            if( m_boundingRect.x() != oldBoundingRect.x() || m_boundingRect.y() != \
oldBoundingRect.y() ) {  if ( frame->isSelected() ) {
                 if ( frameset->type() == FT_TABLE ) {
                     if ( tablesMoved.findRef( static_cast<KWTableFrameSet *> \
(frameset) ) == -1 ) @@ -845,6 +850,7 @@
                     repaintRegion += \
QRegion(oldRect).unite(frameRect).boundingRect();  // Move resize handles to new \
position  frame->updateResizeHandles();
+                    }
                 }
             }
         }


_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel


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

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