diff --git a/src/libImaging/Draw.c b/src/libImaging/Draw.c index 829de735489..108aebb019e 100644 --- a/src/libImaging/Draw.c +++ b/src/libImaging/Draw.c @@ -501,7 +501,8 @@ polygon_generic( // Needed to draw consistent polygons xx[j] = xx[j - 1]; j++; - } else if (current->dx != 0 && j % 2 == 1 && + } else if ((ymin == current->ymin || ymin == current->ymax) && + current->dx != 0 && j % 2 == 1 && roundf(xx[j - 1]) == xx[j - 1]) { // Connect discontiguous corners for (k = 0; k < i; k++) {