Bug 573044 - Don't draw arc if height or width equals to zero
This prevents calling cairo_scale with a scaling factor of zero, thus
setting an error code in cairo which would make cairo_restore return
immediately without restoring the state.
Change-Id: I30dc65f6b5b283a3b76f7b47255c005ad6c6e037
Signed-off-by: Adrien Thierry <adrien.thierry@spacecodesign.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/179600
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Niraj Modi <niraj.modi@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
index 376aeda..f8fe7d3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
@@ -218,6 +218,7 @@
*/
public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (width == 0 || height == 0) return;
x = DPIUtil.autoScaleUp(x);
y = DPIUtil.autoScaleUp(y);
width = DPIUtil.autoScaleUp(width);