From 97d0f8f43db98e1c5ae49bd32dfc027e6d3a1349 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= <trond@trolltech.com>
Date: Mon, 18 May 2009 09:59:06 +0200
Subject: Fixed a bug which implicitly closed perspective transformed poly
 lines.

When the end point of a line in a path is clipped, only closed paths
should have the closing line.

Task-number: 253663
Reviewed-by: Samuel
---
 src/gui/painting/qtransform.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 2383272..cec2d16 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1355,7 +1355,8 @@ static inline QHomogeneousCoordinate mapHomogeneous(const QTransform &transform,
     return c;
 }
 
-static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, bool needsMoveTo)
+static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b,
+                                  bool needsMoveTo, bool needsLineTo = true)
 {
     QHomogeneousCoordinate ha = mapHomogeneous(transform, a);
     QHomogeneousCoordinate hb = mapHomogeneous(transform, b);
@@ -1388,7 +1389,8 @@ static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transfor
     if (needsMoveTo)
         path.moveTo(ha.toPoint());
 
-    path.lineTo(hb.toPoint());
+    if (needsLineTo)
+        path.lineTo(hb.toPoint());
 
     return true;
 }
@@ -1455,7 +1457,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat
     }
 
     if (path.elementCount() > 0 && lastMoveTo != last)
-        lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo);
+        lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false);
 
     return result;
 }
-- 
cgit v0.12