diff options
author | Thomas Wolf | 2021-08-15 19:05:35 +0000 |
---|---|---|
committer | Andrey Loskutov | 2021-08-16 13:41:54 +0000 |
commit | f902ddb0221245316c5913c4dde317f52c453770 (patch) | |
tree | 9d7d738f159f3509d88f751b419d3b96e9734105 | |
parent | ee30e85a79fe192c6c45fe67664a4bf3360d2bea (diff) | |
download | eclipse.platform.swt-f902ddb0221245316c5913c4dde317f52c453770.tar.gz eclipse.platform.swt-f902ddb0221245316c5913c4dde317f52c453770.tar.xz eclipse.platform.swt-f902ddb0221245316c5913c4dde317f52c453770.zip |
Bug 575398 - CTabFolderRenderer: fix drawing the cross on Win32
Drawing without anti-aliasing on Win32 makes the red cross of the
close button lopsided on non-HiDPI displays. With anti-aliasing
turned on, Win32 manages to produce a nice looking symmetric cross.
Change-Id: Ib61d54231e08321d9689ff66df565487b670c400
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184032
Tested-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java index 396bfdaac6..37ceb419f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java @@ -60,6 +60,8 @@ public class CTabFolderRenderer { private Font chevronFont = null; + private boolean antiAlias = true; + //TOP_LEFT_CORNER_HILITE is laid out in reverse (ie. top to bottom) //so can fade in same direction as right swoop curve static final int[] TOP_LEFT_CORNER_HILITE = new int[] {5,2, 4,2, 3,3, 2,4, 2,5, 1,6}; @@ -870,6 +872,13 @@ public class CTabFolderRenderer { int y = closeRect.y + Math.max(1, (closeRect.height-lineLength)/2); y += parent.onBottom ? -1 : 1; int originalLineWidth = gc.getLineWidth(); + if (antiAlias) { + try { + gc.setAntialias(SWT.ON); + } catch (SWTException e) { + antiAlias = false; + } + } switch (closeImageState & (SWT.HOT | SWT.SELECTED | SWT.BACKGROUND)) { case SWT.NONE: { drawCloseLines(gc, x, y , lineLength, false); |