Capped sweeps at 2π radians.

This commit is contained in:
Pietro Gagliardi 2015-10-09 22:00:41 -04:00
parent 2c7ed07747
commit 73d77ef38b
4 changed files with 11 additions and 0 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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 <math.h>
#include <gtk/gtk.h>
#include "../ui.h"
#include "../ui_unix.h"

View File

@ -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;