Browse Source

PathFlatteningIterator: Ensure iterator terminates when flattening paths with very large coordinate values

v6.1.6
reuk 4 years ago
parent
commit
8dc7636fc4
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      modules/juce_graphics/geometry/juce_PathIterator.cpp

+ 13
- 3
modules/juce_graphics/geometry/juce_PathIterator.cpp View File

@@ -166,7 +166,11 @@ bool PathFlatteningIterator::next()
auto errorX = m3x - x2;
auto errorY = m3y - y2;
if (errorX * errorX + errorY * errorY > toleranceSquared)
auto outsideTolerance = errorX * errorX + errorY * errorY > toleranceSquared;
auto canBeSubdivided = (m3x != m1x && m3x != m2x)
|| (m3y != m1y && m3y != m2y);
if (outsideTolerance && canBeSubdivided)
{
*stackPos++ = y3;
*stackPos++ = x3;
@@ -220,8 +224,14 @@ bool PathFlatteningIterator::next()
auto error2X = m5x - x3;
auto error2Y = m5y - y3;
if (error1X * error1X + error1Y * error1Y > toleranceSquared
|| error2X * error2X + error2Y * error2Y > toleranceSquared)
auto outsideTolerance = error1X * error1X + error1Y * error1Y > toleranceSquared
|| error2X * error2X + error2Y * error2Y > toleranceSquared;
auto canBeSubdivided = (m4x != m1x && m4x != m2x)
|| (m4y != m1y && m4y != m2y)
|| (m5x != m3x && m5x != m2x)
|| (m5y != m3y && m5y != m2y);
if (outsideTolerance && canBeSubdivided)
{
*stackPos++ = y4;
*stackPos++ = x4;


Loading…
Cancel
Save