Skip to content

Commit

Permalink
fix #643
Browse files Browse the repository at this point in the history
  • Loading branch information
hx2A committed Aug 27, 2023
1 parent f1da373 commit 4a967e3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/src/processing/core/PShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -1786,6 +1806,10 @@ protected void drawGeometry(PGraphics g) {
}
}
}

if (insideContour) {
g.endContour();
}
g.endShape(close ? CLOSE : OPEN);
}

Expand Down

0 comments on commit 4a967e3

Please sign in to comment.