From 01ad91d85173e12b206bb798518072e1244665c2 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 2 Jan 2009 14:33:42 +0000 Subject: [PATCH] small fix to sort out stroking of paths that contain lines of 0 length. --- juce_amalgamated.cpp | 2 ++ juce_amalgamated.h | 4 +++- .../gui/graphics/geometry/juce_PathIterator.cpp | 2 ++ .../gui/graphics/geometry/juce_PathIterator.h | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index f90b7ff8b9..c367713c82 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -85740,6 +85740,8 @@ bool PathFlatteningIterator::next() throw() } else { + jassert (type == Path::moveMarker); + subPathIndex = -1; subPathCloseX = x1 = x2; subPathCloseY = y1 = y2; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 35fb740344..201debdf61 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -39562,7 +39562,9 @@ public: int subPathIndex; /** Returns true if the current segment is the last in the current sub-path. */ - bool isLastInSubpath() const throw() { return stackPos == stackBase; } + bool isLastInSubpath() const throw() { return stackPos == stackBase + && (index >= path.numElements + || points [index] == Path::moveMarker); } juce_UseDebuggingNewOperator diff --git a/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.cpp b/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.cpp index 2d33435475..8fa95b7f64 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.cpp +++ b/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.cpp @@ -286,6 +286,8 @@ bool PathFlatteningIterator::next() throw() } else { + jassert (type == Path::moveMarker); + subPathIndex = -1; subPathCloseX = x1 = x2; subPathCloseY = y1 = y2; diff --git a/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.h b/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.h index 798b756aa8..836708fe79 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.h +++ b/src/juce_appframework/gui/graphics/geometry/juce_PathIterator.h @@ -101,7 +101,9 @@ public: int subPathIndex; /** Returns true if the current segment is the last in the current sub-path. */ - bool isLastInSubpath() const throw() { return stackPos == stackBase; } + bool isLastInSubpath() const throw() { return stackPos == stackBase + && (index >= path.numElements + || points [index] == Path::moveMarker); } //==============================================================================