-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix Faulty Scaling in GC #11
Fix Faulty Scaling in GC #11
Comments
I have already investigated the issue and developed a snippet for reproduction here: https://github.com/HeikoKlare/eclipse.platform.swt/tree/snippet-381-gc-transformation It is extended with a potential fix and a comparison in the snippet here: https://github.com/HeikoKlare/eclipse.platform.swt/tree/gc-transformation-comparison I will provide these artifacts, an issue and PR with the fix proposal to the Eclipse repositories as soon as possible. |
Issue is documented here: eclipse-platform/eclipse.platform.swt#788 |
Done by merging eclipse-platform/eclipse.platform.swt#789 |
Original PR reverted because of regression. Improved version has been merged: eclipse-platform/eclipse.platform.swt#1073 |
Current Behavior
The
GC
class provides functionality to apply a transformation (translation, scaling, rotation) to the graphics canvas.This functionality is broken when applying rotations to the GC, leading to
The reason is in a faulty way in which the offset for odd line widths is calculated: https://github.com/eclipse-platform/eclipse.platform.swt/blob/4daf005a457fb50b929719cb5b3616e55cc2e5c4/bundles/org.eclipse.swt/Eclipse%20SWT/win32/org/eclipse/swt/graphics/GC.java#L326-L344
To reproduce an extreme case, apply a 45° rotation to the GC and try to draw something. Nothing will be drawn because a very large offset is erroneously calculated.
Expected Behavior
Offset calculation in the GC should be performed properly. No draw operations should be lost and no off-by-one errors should occur.
Additional Information
We have used the following patch which only hides the actual problem under specific usage conditions but does not solve it:
The text was updated successfully, but these errors were encountered: