From 4a967e319882a9a4771456619dea1a1e60ec3d30 Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 27 Aug 2023 10:01:49 -0400 Subject: [PATCH] fix #643 --- core/src/processing/core/PShape.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/core/src/processing/core/PShape.java b/core/src/processing/core/PShape.java index 3d7118368..28e0f0847 100644 --- a/core/src/processing/core/PShape.java +++ b/core/src/processing/core/PShape.java @@ -1772,12 +1772,32 @@ protected void drawPrimitive(PGraphics g) { protected void drawGeometry(PGraphics g) { // get cache object using g. g.beginShape(kind); + + boolean insideContour = false; + int codeIndex = 0; + if (style) { for (int i = 0; i < vertexCount; i++) { + if (vertexCodes[codeIndex++] == BREAK) { + if (insideContour) { + g.endContour(); + } + g.beginContour(); + insideContour = true; + } + g.vertex(vertices[i]); } } else { for (int i = 0; i < vertexCount; i++) { + if (vertexCodes[codeIndex++] == BREAK) { + if (insideContour) { + g.endContour(); + } + g.beginContour(); + insideContour = true; + } + float[] vert = vertices[i]; if (vert.length < 3 || vert[Z] == 0) { g.vertex(vert[X], vert[Y]); @@ -1786,6 +1806,10 @@ protected void drawGeometry(PGraphics g) { } } } + + if (insideContour) { + g.endContour(); + } g.endShape(close ? CLOSE : OPEN); }