* More polyfill fixes 4.x-dev

Tue, 13 Jul 2021 11:22:43 +0300

author
cemkalyoncu
date
Tue, 13 Jul 2021 11:22:43 +0300
branch
4.x-dev
changeset 1715
32784d399331
parent 1714
8f26a5085048
child 1716
d02bc2e9b8ed

* More polyfill fixes

Source/Gorgon/CGI/Polygon.h file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/CGI/Polygon.h	Mon Jul 12 20:43:54 2021 +0300
+++ b/Source/Gorgon/CGI/Polygon.h	Tue Jul 13 11:22:43 2021 +0300
@@ -86,7 +86,7 @@
                 int miny = (int)round(min.Y * scale);
                 int maxy = (int)round(line.MaxY() * scale);
                 
-                if(miny == maxy || miny > ymax || maxy < ymin)
+                if(miny == maxy || miny >= ymax || maxy <= ymin)
                     continue;
                 
                 auto slopeinv = line.SlopeInv();
@@ -147,7 +147,7 @@
             while(it != end) {
                 if(!winding) {
                     std::partial_sort(it, it+1, end, [](const activeline &l, const activeline &r) {
-                        return l.x2 < r.x2;
+                        return Clamp(l.x2, l.minx, l.maxx) < Clamp(r.x2, r.minx, r.maxx);
                     });
 
                     if(strict == polygonstrictmode::outside)
@@ -160,7 +160,7 @@
                 }
                 else {
                     std::partial_sort(it, it+1, end, [](const activeline &l, const activeline &r) {
-                        return l.x1 < r.x1;
+                        return Clamp(l.x1, l.minx, l.maxx) < Clamp(r.x1, r.minx, r.maxx);
                     });
                     
                     if(W_ == 0) {

mercurial