-
Notifications
You must be signed in to change notification settings - Fork 185
[Win32] Pass point values to size computation methods #2717
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] Pass point values to size computation methods #2717
Conversation
54b1e7f to
918b82c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look reasonable. Passing the point value to computeSizeInPixels significantly reduces the amount of DPIUtil.pixelToPoint calls inside the method. The code looks sound and doesn't break anything upon running. I have tested it on zoom level 250%, 150% and 175%. Is it possible to add a unit test to test the precision? I'm approving it already.
I did not find a way to demonstrate the higher precision yet. Probably you can produce some scenario with specific zoom and size values and an according layout involved, but even if you found such a scenario, the test for it would be very specific. I would rather flag this as a simplification with the ability to improve precision without actually claiming the latter. |
I was just wondering if there's a direct way to test that. But its fine without. |
918b82c to
9171d8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good looks good. Only have nitpicky comments
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java
Outdated
Show resolved
Hide resolved
This increase precision of size computation by reducing the number of pixel/point conversions. In particular, the minimumSize() method unnecessarily calculated in pixels even though all relevant values are in points. Inside the computeSizeInPixels() methods, several conversions were done as most other called methods operate on point values.
9171d8c to
795e239
Compare
This increase precision of size computation by reducing the number of pixel/point conversions. In particular, the minimumSize() method unnecessarily calculated in pixels even though all relevant values are in points. Inside the computeSizeInPixels() methods, several conversions were done as most other called methods operate on point values.
I was not able to demonstrate benefits of the higher precision yet, but it anyway cleans up the code by removing unnecessary conversions.