From ee138b6c33c0b08e70b040363839c7a9e87f93da Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 3 Jan 2025 11:56:11 +1100 Subject: [PATCH] Speed up code by only checking other edges at the end of this edge --- src/libImaging/Draw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++) {