Skip to content

Commit 9383666

Browse files
knocteaarani
andcommitted
GTK: fix small arc rendering problem
GeometryHelper.FlattenArc function returns a NaN point when flattening very small arcs. Cairo doesn't ignore NaN points and would draw an out-of-place line instead, which we need to tweak to prevent weird renderings. Fixes xamarin#15130 Upstream PR: xamarin#15131 Co-authored-by: Afshin Arani <[email protected]>
1 parent a94944f commit 9383666

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Xamarin.Forms.Platform.GTK/Controls/Shapes/PathView.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ protected override void Draw(Gdk.Rectangle area, Context cr)
5151

5252
for (int i = 0; i < points.Count; i++)
5353
{
54-
cr.LineTo(points[i].X, points[i].Y);
54+
if (!double.IsNaN(points[i].X) && !double.IsNaN(points[i].Y))
55+
cr.LineTo(points[i].X, points[i].Y);
5556
}
5657

5758
if (points.Count > 0)
58-
lastPoint = points[points.Count - 1];
59+
if (!double.IsNaN(points[points.Count - 1].X) && !double.IsNaN(points[points.Count - 1].Y))
60+
lastPoint = points[points.Count - 1];
5961

6062
}
6163
}

0 commit comments

Comments
 (0)