summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2006-03-15 22:37:12 +0000
committerSilenio Quarti <silenio>2006-03-15 22:37:12 +0000
commitdd3b53ce0c05a3da5c9f080255bedfae78e32302 (patch)
treec597da21003d539f380e6860216b416bbba086ca
parentd94617ab8b474088d65ad912710a4b9e96885306 (diff)
downloadeclipse.platform.swt-dd3b53ce0c05a3da5c9f080255bedfae78e32302.tar.gz
eclipse.platform.swt-dd3b53ce0c05a3da5c9f080255bedfae78e32302.tar.xz
eclipse.platform.swt-dd3b53ce0c05a3da5c9f080255bedfae78e32302.zip
131867 - Incorrect GC.fillPath() behavior
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Path.java6
2 files changed, 15 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
index 4c60ad243a..6d67046e49 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
@@ -567,7 +567,11 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
float offset = data.lineWidth == 0 || (data.lineWidth % 2) == 1 ? 0.5f : 0f;
OS.CGContextTranslateCTM(handle, x + offset + width / 2f, y + offset + height / 2f);
OS.CGContextScaleCTM(handle, width / 2f, height / 2f);
- OS.CGContextAddArc(handle, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ if (arcAngle < 0) {
+ OS.CGContextAddArc(handle, 0, 0, 1, (startAngle + arcAngle) * (float)Compatibility.PI / 180, startAngle * (float)Compatibility.PI / 180, true);
+ } else {
+ OS.CGContextAddArc(handle, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ }
OS.CGContextRestoreGState(handle);
OS.CGContextStrokePath(handle);
flush();
@@ -1296,7 +1300,11 @@ public void fillArc(int x, int y, int width, int height, int startAngle, int arc
OS.CGContextTranslateCTM(handle, x + width / 2f, y + height / 2f);
OS.CGContextScaleCTM(handle, width / 2f, height / 2f);
OS.CGContextMoveToPoint(handle, 0, 0);
- OS.CGContextAddArc(handle, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ if (arcAngle < 0) {
+ OS.CGContextAddArc(handle, 0, 0, 1, (startAngle + arcAngle) * (float)Compatibility.PI / 180, startAngle * (float)Compatibility.PI / 180, true);
+ } else {
+ OS.CGContextAddArc(handle, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ }
OS.CGContextClosePath(handle);
OS.CGContextRestoreGState(handle);
OS.CGContextFillPath(handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Path.java
index 4cd7e7614d..26ddd89588 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Path.java
@@ -97,7 +97,11 @@ public void addArc(float x, float y, float width, float height, float startAngle
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
float[] cmt = new float[6];
OS.CGAffineTransformMake(width / 2f, 0, 0, height / 2f, x + width / 2f, y + height / 2f, cmt);
- OS.CGPathAddArc(handle, cmt, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ if (arcAngle < 0) {
+ OS.CGPathAddArc(handle, cmt, 0, 0, 1, (startAngle + arcAngle) * (float)Compatibility.PI / 180, startAngle * (float)Compatibility.PI / 180, true);
+ } else {
+ OS.CGPathAddArc(handle, cmt, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180, true);
+ }
}
/**