From 7e8218163f77a0d03fc2d73b5e1ce40133b95d37 Mon Sep 17 00:00:00 2001 From: Phillipus Date: Sat, 6 Jan 2024 16:45:01 +0000 Subject: [PATCH] [GEF] Remove workaround for connection line dash spacing bug on Windows 200% scale - This is fixed - See https://github.com/eclipse-platform/eclipse.platform.swt/issues/687 --- .../graphiti/GraphicsToGraphics2DAdaptor.java | 4 +-- .../src/org/eclipse/draw2d/SWTGraphics.java | 30 +------------------ 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/com.archimatetool.export.svg/src/com/archimatetool/export/svg/graphiti/GraphicsToGraphics2DAdaptor.java b/com.archimatetool.export.svg/src/com/archimatetool/export/svg/graphiti/GraphicsToGraphics2DAdaptor.java index e21f8623b..0d1cc0ed8 100644 --- a/com.archimatetool.export.svg/src/com/archimatetool/export/svg/graphiti/GraphicsToGraphics2DAdaptor.java +++ b/com.archimatetool.export.svg/src/com/archimatetool/export/svg/graphiti/GraphicsToGraphics2DAdaptor.java @@ -1119,9 +1119,7 @@ public void setLineDash(int[] dash) { public void setLineDash(float[] dash) { currentState.lineAttributes.dash = dash; setLineStyle(Graphics.LINE_CUSTOM); - // Don't apply the Windows 200% scaling workaround as it's not needed - // When exporting to SVG - swtGraphics.setLineDash(dash, false); + swtGraphics.setLineDash(dash); } /* diff --git a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java index 7c4021d0e..c4c2c5d69 100644 --- a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java +++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java @@ -39,7 +39,7 @@ *

* WARNING: This class is not intended to be subclassed. */ -@SuppressWarnings({"rawtypes", "unchecked", "restriction"}) +@SuppressWarnings({"rawtypes", "unchecked"}) public class SWTGraphics extends Graphics { private double scale = 1.0; @@ -1286,21 +1286,7 @@ public void setInterpolation(int interpolation) { @Override public void setLineAttributes(LineAttributes lineAttributes) { - setLineAttributes(lineAttributes, true); - } - - public void setLineAttributes(LineAttributes lineAttributes, boolean adjustForWindowsHiDPI) { copyLineAttributes(currentState.lineAttributes, lineAttributes); - - /* - * Hack to workaround bug on Windows 200% scaling where dashes are half size - * See https://github.com/eclipse-platform/eclipse.platform.swt/issues/687 - */ - if(adjustForWindowsHiDPI && currentState.lineAttributes.dash != null && "win32".equals(SWT.getPlatform())) { //$NON-NLS-1$ - for(int i = 0; i < currentState.lineAttributes.dash.length; i++) { - currentState.lineAttributes.dash[i] *= org.eclipse.swt.internal.DPIUtil.getDeviceZoom() / 100; - } - } } /** @@ -1332,10 +1318,6 @@ public void setLineDash(int[] dashes) { */ @Override public void setLineDash(float[] value) { - setLineDash(value, true); - } - - public void setLineDash(float[] value, boolean adjustForWindowsHiDPI) { if (value != null) { // validate dash values for (int i = 0; i < value.length; i++) { @@ -1343,16 +1325,6 @@ public void setLineDash(float[] value, boolean adjustForWindowsHiDPI) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } } - - /* - * Hack to workaround bug on Windows 200% scaling where dashes are half size - * See https://github.com/eclipse-platform/eclipse.platform.swt/issues/687 - */ - if(adjustForWindowsHiDPI && "win32".equals(SWT.getPlatform())) { //$NON-NLS-1$ - for(int i = 0; i < value.length; i++) { - value[i] *= org.eclipse.swt.internal.DPIUtil.getDeviceZoom() / 100; - } - } currentState.lineAttributes.dash = value.clone(); currentState.lineAttributes.style = SWT.LINE_CUSTOM;