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

List:       koffice-devel
Subject:    koffice/libs/guiutils
From:       Jan Hambrecht <jaham () gmx ! net>
Date:       2009-04-26 22:27:21
Message-ID: 1240784841.328652.13751.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 959725 by jaham:

fix calculating offset to fit shapes into specified painter rectangle
(the painter rectangle does not necessarily start at point 0,0)

please review for backporting

CCMAIL:koffice-devel@kde.org



 M  +4 -3      KoShapePainter.cpp  


--- trunk/koffice/libs/guiutils/KoShapePainter.cpp #959724:959725
@@ -162,10 +162,11 @@
     painter.setRenderHint(QPainter::Antialiasing);
     painter.setClipRect( painterRect );
 
+    // convert document rectangle to view coordinates
     QRectF zoomedBound = zoomHandler.documentToView( documentRect );
-    QPointF offset = QPointF( 0.5 * painterRect.width(), 0.5 * painterRect.height() \
                ) - zoomedBound.center();
-
-    // center content in image
+    // calculate offset between painter rectangle and converted document rectangle
+    QPointF offset = QPointF(painterRect.center()) - zoomedBound.center();
+    // center content in painter rectangle
     painter.translate( offset.x(), offset.y() );
 
     // finally paint the shapes
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.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