-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Win32] Drawing produces unsymmetric results without swt.autoScale=false for 4k monitor with zooming #1596
Comments
The oval at 100% is also asymmetric (can be seen in different colors from anti-aliasing), it only becomes more visible at 175% because the calculation is more off. With |
Asking users, I reckon 99% would answer the 100% version looks symmetric. How do we need to draw these elements that they look fine between 100% and 200% zoom level for 99% of the users? |
Might be, but what does that change? Using the 175% version and placing users at 175% the distance of the monitor than when using the 100% version, they will probably also consider it symmetric...
My first impression is that this is a bug in SWT. So there may be no other way than looking into SWT code, finding the cause of the bug, and fixing it. |
If I look at your snippet I'm not sure you are taking the line width into account correctly, you set a line width of three but I can't find you possibly account for this. Beside that, yes only having int coordinates (except for example Path) is a big limitation compared to e.g. AWTs Graphics2D, e.g AWT uses the concept of Shapes what is really convenient and powerful. |
@laeubi In SmartGit we are using the zoom factor (1 or 2) to draw the lines with the correct width. The result looks correct with all zoom levels. |
Assuming following code: gc.setLineWidth(1);
gc.drawLine(0, 1, 10, 1); what exactly we can expect to happen for 100% zoom level and especially for 200% zoom level? How wide the line should be with 200% zoom (I'd expect 2 pixels), where exactly it should be drawn, should the line be fully visible if drawn at the coordinate 0? Assuming the following code: gc.fillRect(1, 1, 10, 5); how wide the rect (in pixels) should be with 200% zoom? Which pixels should be covered? Should we expect to get the same rendering result on all 3 platforms? |
When drawing a vertical line at x == 1 with 200% zoom level (HiDPI), MacOS draws it on the physical pixel coordinates 2 and 3 while on Windows (with the existing code) it was drawn at 1 and 2. In other words: the existing code drew lines 1 pixel too far left/top. This commit should resolve this.
…ithout swt.autoScale=false for 4k monitor with zooming When drawing a vertical line at x == 1 with 200% zoom level (HiDPI), MacOS draws it on the physical pixel coordinates 2 and 3 while on Windows (with the existing code) it was drawn at 1 and 2. In other words: the existing code drew lines 1 pixel too far left/top. This commit should resolve this.
Please give the pull request a try. |
You mean this one: #1607 ? |
Yes, this the PR #1607. I know that it can't be merged right now because of feature-freeze, but I want you to give it a try. |
…ithout swt.autoScale=false for 4k monitor with zooming When drawing a vertical line at x == 1 with 200% zoom level (HiDPI), MacOS draws it on the physical pixel coordinates 2 and 3 while on Windows (with the existing code) it was drawn at 1 and 2. In other words: the existing code drew lines 1 pixel too far left/top. This commit should resolve this.
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
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:
Tried on Windows 11 with 4k monitor.
The text was updated successfully, but these errors were encountered: