From 03fa73c326552448f267d892099f00c153556ffb Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Mon, 21 Aug 2023 15:26:41 +0100
Subject: [PATCH] Fix wrong line width on Windows hi-dpi
- On Windows hi-dpi calling GC#setLineAttributes will mean that lineattributes.width is increased by calling DPIUtil.autoScaleUp so we clone lineAttributes
- See https://github.com/eclipse/gef-classic/issues/248
---
org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
index 125dcae27..b504fbd7a 100644
--- a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
+++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
@@ -306,7 +306,7 @@ protected final void checkPaint() {
LineAttributes lineAttributes = currentState.lineAttributes;
if (!appliedState.lineAttributes.equals(lineAttributes)) {
if (getAdvanced()) {
- gc.setLineAttributes(lineAttributes);
+ gc.setLineAttributes(clone(lineAttributes)); // Clone lineAttributes because on Windows hi-dpi the line width may be increased
} else {
gc.setLineWidth((int) lineAttributes.width);
gc.setLineCap(lineAttributes.cap);