private void Next(bool doNext)
        {
            int level;

            if (HoldIndex >= HoldEnd)
            {
                if (doNext)
                {
                    Src.Next();
                }
                if (Src.Done)
                {
                    Done_Renamed = true;
                    return;
                }
                HoldType   = Src.CurrentSegment(Hold);
                LevelIndex = 0;
                Levels[0]  = 0;
            }

            switch (HoldType)
            {
            case PathIterator_Fields.SEG_MOVETO:
            case PathIterator_Fields.SEG_LINETO:
                Curx = Hold[0];
                Cury = Hold[1];
                if (HoldType == PathIterator_Fields.SEG_MOVETO)
                {
                    Movx = Curx;
                    Movy = Cury;
                }
                HoldIndex = 0;
                HoldEnd   = 0;
                break;

            case PathIterator_Fields.SEG_CLOSE:
                Curx      = Movx;
                Cury      = Movy;
                HoldIndex = 0;
                HoldEnd   = 0;
                break;

            case PathIterator_Fields.SEG_QUADTO:
                if (HoldIndex >= HoldEnd)
                {
                    // Move the coordinates to the end of the array.
                    HoldIndex           = Hold.Length - 6;
                    HoldEnd             = Hold.Length - 2;
                    Hold[HoldIndex + 0] = Curx;
                    Hold[HoldIndex + 1] = Cury;
                    Hold[HoldIndex + 2] = Hold[0];
                    Hold[HoldIndex + 3] = Hold[1];
                    Hold[HoldIndex + 4] = Curx = Hold[2];
                    Hold[HoldIndex + 5] = Cury = Hold[3];
                }

                level = Levels[LevelIndex];
                while (level < Limit)
                {
                    if (QuadCurve2D.GetFlatnessSq(Hold, HoldIndex) < Squareflat)
                    {
                        break;
                    }

                    EnsureHoldCapacity(4);
                    QuadCurve2D.Subdivide(Hold, HoldIndex, Hold, HoldIndex - 4, Hold, HoldIndex);
                    HoldIndex -= 4;

                    // Now that we have subdivided, we have constructed
                    // two curves of one depth lower than the original
                    // curve.  One of those curves is in the place of
                    // the former curve and one of them is in the next
                    // set of held coordinate slots.  We now set both
                    // curves level values to the next higher level.
                    level++;
                    Levels[LevelIndex] = level;
                    LevelIndex++;
                    Levels[LevelIndex] = level;
                }

                // This curve segment is flat enough, or it is too deep
                // in recursion levels to try to flatten any more.  The
                // two coordinates at holdIndex+4 and holdIndex+5 now
                // contain the endpoint of the curve which can be the
                // endpoint of an approximating line segment.
                HoldIndex += 4;
                LevelIndex--;
                break;

            case PathIterator_Fields.SEG_CUBICTO:
                if (HoldIndex >= HoldEnd)
                {
                    // Move the coordinates to the end of the array.
                    HoldIndex           = Hold.Length - 8;
                    HoldEnd             = Hold.Length - 2;
                    Hold[HoldIndex + 0] = Curx;
                    Hold[HoldIndex + 1] = Cury;
                    Hold[HoldIndex + 2] = Hold[0];
                    Hold[HoldIndex + 3] = Hold[1];
                    Hold[HoldIndex + 4] = Hold[2];
                    Hold[HoldIndex + 5] = Hold[3];
                    Hold[HoldIndex + 6] = Curx = Hold[4];
                    Hold[HoldIndex + 7] = Cury = Hold[5];
                }

                level = Levels[LevelIndex];
                while (level < Limit)
                {
                    if (CubicCurve2D.GetFlatnessSq(Hold, HoldIndex) < Squareflat)
                    {
                        break;
                    }

                    EnsureHoldCapacity(6);
                    CubicCurve2D.Subdivide(Hold, HoldIndex, Hold, HoldIndex - 6, Hold, HoldIndex);
                    HoldIndex -= 6;

                    // Now that we have subdivided, we have constructed
                    // two curves of one depth lower than the original
                    // curve.  One of those curves is in the place of
                    // the former curve and one of them is in the next
                    // set of held coordinate slots.  We now set both
                    // curves level values to the next higher level.
                    level++;
                    Levels[LevelIndex] = level;
                    LevelIndex++;
                    Levels[LevelIndex] = level;
                }

                // This curve segment is flat enough, or it is too deep
                // in recursion levels to try to flatten any more.  The
                // two coordinates at holdIndex+6 and holdIndex+7 now
                // contain the endpoint of the curve which can be the
                // endpoint of an approximating line segment.
                HoldIndex += 6;
                LevelIndex--;
                break;
            }
        }