From 73d77ef38bd8c715ea4f4afcee507e81a8873620 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 9 Oct 2015 22:00:41 -0400 Subject: [PATCH] =?UTF-8?q?Capped=20sweeps=20at=202=CF=80=20radians.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- darwin/draw.m | 2 ++ unix/draw.c | 4 ++++ unix/uipriv_unix.h | 3 +++ windows/draw.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/darwin/draw.m b/darwin/draw.m index 178dbca7..f0288303 100644 --- a/darwin/draw.m +++ b/darwin/draw.m @@ -56,6 +56,8 @@ void uiDrawPathArcTo(uiDrawPath *p, double xCenter, double yCenter, double radiu { if (p->ended) complain("attempt to add arc to ended path in uiDrawPathArcTo()"); + if (sweep > 2 * M_PI) + sweep = 2 * M_PI; // TODO wasn't there a relative function? CGPathAddArc(p->path, NULL, xCenter, yCenter, diff --git a/unix/draw.c b/unix/draw.c index 5a0cc84d..5cd40ab4 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -59,6 +59,8 @@ void uiDrawPathNewFigureWithArc(uiDrawPath *p, double xCenter, double yCenter, d { struct piece piece; + if (sweep > 2 * M_PI) + sweep = 2 * M_PI; piece.type = newFigureArc; piece.d[0] = xCenter; piece.d[1] = yCenter; @@ -82,6 +84,8 @@ void uiDrawPathArcTo(uiDrawPath *p, double xCenter, double yCenter, double radiu { struct piece piece; + if (sweep > 2 * M_PI) + sweep = 2 * M_PI; piece.type = arcTo; piece.d[0] = xCenter; piece.d[1] = yCenter; diff --git a/unix/uipriv_unix.h b/unix/uipriv_unix.h index fa85799d..72b73e8a 100644 --- a/unix/uipriv_unix.h +++ b/unix/uipriv_unix.h @@ -3,6 +3,9 @@ #define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_32 #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4 #define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4 +// TODO make this unnecessary +#define _GNU_SOURCE +#include #include #include "../ui.h" #include "../ui_unix.h" diff --git a/windows/draw.c b/windows/draw.c index 9c2f7569..0425ae33 100644 --- a/windows/draw.c +++ b/windows/draw.c @@ -148,6 +148,8 @@ static void doDrawArc(ID2D1GeometrySink *sink, double startX, double startY, dou { D2D1_ARC_SEGMENT as; + if (sweep > 2 * M_PI) + sweep = 2 * M_PI; as.point.x = endX; as.point.y = endY; as.size.width = radius;