Bug 242612 - Artefacts while rotating thick lines
Summary: Artefacts while rotating thick lines
Alias: None
Product: koffice
Classification: Applications
Component: general (show other bugs)
Version: git
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KOffice Bug Wranglers
Depends on:
Reported: 2010-06-23 16:53 UTC by BKrev
Modified: 2010-12-23 16:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

Screenshot (118.04 KB, image/png)
2010-06-23 16:53 UTC, BKrev

Note You need to log in before you can comment on or make changes to this bug.
Description BKrev 2010-06-23 16:53:11 UTC
Created attachment 48269 [details]

Version:           svn (using KDE 4.4.4) 
OS:                Linux

Rotating thick lines causes artefacts.

Reproducible: Didn't try

Steps to Reproduce:
1.) Create a line
2.) Make it huge
3.) Rotate it

This solution seems to work:

--- KoPathShape.cpp     (Revision 1138839)
+++ KoPathShape.cpp     (Arbeitskopie)
@@ -24,6 +24,7 @@
 #include "KoPathPoint.h"
 #include "KoPointGroup.h"
 #include "KoShapeBorderModel.h"
+#include "KoLineBorder.h"
 #include "KoViewConverter.h"
 #include "KoPathShapeLoader.h"
 #include "KoShapeSavingContext.h"
@@ -395,6 +396,14 @@
         QRectF clipRect = filterEffectStack()->clipRectForBoundingRect(QRectF(QPointF(), size()));
         bb |= transform.mapRect(clipRect);
+    //remove artefacts
+    KoLineBorder *lineBorder = dynamic_cast<KoLineBorder *>(border());
+    if (lineBorder) {
+        qreal halfWidth = lineBorder->lineWidth()/2;
+        bb.adjust(-halfWidth, -halfWidth, halfWidth, halfWidth);
+    }
     return bb;
Comment 1 T Zachmann 2010-06-24 08:18:22 UTC
The artefact are not shown when the shape(line) is not rotated. So the bouding box returns the correct size. The bug only happens when the e.g. the shape is rotated. Looks more like a bug in the move tool in case the shapes are rotated.

As the bounding box is also used for aligning objects modifying the bounding box is not an option.
Comment 2 T Zachmann 2010-06-24 08:25:08 UTC
I did some more testing and it looks more like that the bounding box is not correct in case the shape is rotated.
Comment 3 Thomas Zander 2010-06-26 11:02:04 UTC
The boudingbox of path shapes is indeed wrong, its easy to see by inserting any sort of path shape and making the border really large. The default tool draws the outline of the shape in place that doesn't change when the border grows, and as such a big chunk of the actual content falls outside of the bounding box.

The full shape, including the border, has to be contained in the bounding box.

Notice that its easier to see redrawin artifacts if you have two views open and the shape only selected in one of the two views. Rotate it and the other view will show more artifacts.
Comment 4 Thomas Zander 2010-12-23 16:58:03 UTC
SVN commit 1208879 by zander:

Fix bounding rect calculation


 M  +6 -14     KoPathShape.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1208879