[RFC PATCH] mi: reduce missing segments on large ellipse

Olivier Fourdan ofourdan at redhat.com
Thu Apr 16 05:04:21 PDT 2015


With larger ellipses, rounding will cause some spans close to vertical
tangent to be of zero length, leading to sometimes rather large missing
portion of the arc.

Try to detect this case and work around it.

Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 mi/miarc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mi/miarc.c b/mi/miarc.c
index e8bc87e..be9c94c 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -563,6 +563,16 @@ miComputeEllipseSpans(int lw, xArc * parc, miArcSpanData * spdata)
                     outx = x + t;
             }
         }
+        if (ICEIL(xorg + outx) - ICEIL(xorg + inx) < lw ) {
+            if (inx <= 0.0) {
+                outx = outx + ICEIL(-r);
+                inx = inx + ICEIL(r);
+	    }
+	    else {
+                outx = outx + ICEIL(r);
+                inx = inx + ICEIL(-r);
+	    }
+        }
         span->lx = ICEIL(xorg - outx);
         if (inx <= 0.0) {
             spdata->count1++;
-- 
2.3.5



More information about the xorg-devel mailing list