-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
Describe the bug
Code that draws a circle and and a line symmetric with 100% zoom causes asymmetric results with 175% zoom factor.
To Reproduce
Run following snippet
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
public class HiDpiDrawing {
public static void main(String[] args) {
// System.getProperties().putIfAbsent("swt.autoScale", "false");
final Display display = new Display();
final Shell shell = new Shell(display);
shell.addListener(SWT.Paint, event -> {
final GC gc = event.gc;
gc.setAntialias(SWT.ON);
gc.setLineWidth(3);
final Path path = new Path(display);
int radius = 3;
path.moveTo(15, 0);
path.lineTo(15, 15 - radius);
path.moveTo(15, 15 + radius);
path.lineTo(15, 100);
gc.drawPath(path);
path.dispose();
gc.setBackground(gc.getForeground());
drawOval(gc, radius + 2);
gc.setBackground(new Color(255, 255, 255));
drawOval(gc, radius);
});
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
shell.dispose();
}
private static void drawOval(GC gc, int radius) {
gc.fillOval(15 - radius, 15 - radius, 2 * radius + 1, 2 * radius + 1);
}
}on Windows with 100% zoom level and with 175% zoom level.
Expected behavior
The dot is always drawn symmetric to the line, no matter what zoom level (otherwise it would look ugly).
Screenshots
With 100% zoom level:
![]()
close-up:

With 175% zoom level:
![]()
close-up:

When removing the // from the comment line, the result looks fine for 175% zoom, too.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
- Additional OS info (e.g. OS version, Linux Desktop, etc)
Tried on Windows 11 with 4k monitor.
Metadata
Metadata
Assignees
Labels
No labels