summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-04-09 11:15:16 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-04-09 11:15:16 (GMT)
commit3900e09478f01798b4dbcaf573426d886fd2db23 (patch)
tree922478aa8a40a4c79795c7eabfa58de546847a14 /src/opengl
parentfae9fe6326f18faf8531707b37aa349dca3586b2 (diff)
downloadQt-3900e09478f01798b4dbcaf573426d886fd2db23.zip
Qt-3900e09478f01798b4dbcaf573426d886fd2db23.tar.gz
Qt-3900e09478f01798b4dbcaf573426d886fd2db23.tar.bz2
Fixed possible data corruption in the triangulating stroker.
In the case where a polygon or polyline that contains consequtive equal points, we end up calculating an invalid normal vector for the joins. This fix skips past duplicate consequtive points. Task-number: QTBUG-9548 Reviewed-by: Kim
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index 5229d3f..eaa3d57 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -144,11 +144,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen)
m_cos_theta = qFastCos(Q_PI / m_roundness);
const qreal *endPts = pts + (count<<1);
- const qreal *startPts;
+ const qreal *startPts = 0;
Qt::PenCapStyle cap = m_cap_style;
if (!types) {
+ // skip duplicate points
+ while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3])
+ pts += 2;
+ if ((pts + 2) == endPts)
+ return;
+
startPts = pts;
bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1);
@@ -161,15 +167,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen)
lineTo(pts);
pts += 2;
while (pts < endPts) {
- join(pts);
- lineTo(pts);
+ if (m_cx != pts[0] || m_cy != pts[1]) {
+ join(pts);
+ lineTo(pts);
+ }
pts += 2;
}
endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart);
} else {
- bool endsAtStart;
+ bool endsAtStart = false;
while (pts < endPts) {
switch (*types) {
case QPainterPath::MoveToElement: {