-
Notifications
You must be signed in to change notification settings - Fork 143
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
Correct GC offset calculation #788 #789
Conversation
5b6e272
to
acf2896
Compare
fcbf1ac
to
33ba375
Compare
@fedejeanne would be great if you can validate this one, particularly on other systems than Windows. In case this PR get approved for merging, it would be good if that happens early in the development cycle to see if there is some consumer depending on the existing (incorrect) behavior, as it has been there for around 20 years now. |
I'll try to take a look at it today/tomorrow :) |
In Linux
SummarySame as for Mac except for the last item:
Some screenshotsIn "the big display": DELL U2518D (25'', 3840x2160)
In "the small display": HP (17'', 1920x1080)
|
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.
Linux and Mac look good
Thank you for that detailed validation, @fedejeanne! Great to see that the patch also works fine on Linux and Mac. I also made two validations with downstream consumers:
I would like to give this a try and merge in the next days, so that there is sufficient time in the current release cycle to detect potential regressions. |
ca81570
to
b7caca2
Compare
…rm#788 The snippet can be used to show how a pattern of multiple lines is printed with different line widths and different kinds of transformations applied to the GC (scaling and rotation). It serves as a demonstrator for issues with the GC offset calculation documented in eclipse-platform#788
The offset calculation in the GC when having an odd line width is erroneous in case rotation transformations have been applied to the GC. With a rotation of 45°, the calculation even suffers from singularities that result in effectively nothing being drawn. With other transformation properties, off-by-one error occur. This change inverts the offset calculation: Instead of performing a forward transformation of a dummy point whose result is applied to the expected offset, the inverse transformation is applied to the expected offset. This avoids singularities and imprecision in the calculation and ensures that when applying rotations to the GC, the drawing figures are as expected. Fixes eclipse-platform#788
b7caca2
to
239b050
Compare
I integrated the commit with the snippet to visualize the original issue and the fix originally provided in #787 into this PR. Since no objections have been made to this PR, I will merge it now. |
The offset calculation in the
GC
when having an odd line width is erroneous in case rotation transformations have been applied to theGC
. With a rotation of 45°, the calculation even suffers from singularities that result in effectively nothing being drawn. With other transformation properties, off-by-one error occur.This change inverts the offset calculation: Instead of performing a forward transformation of a dummy point whose result is applied to the expected offset, the inverse transformation is applied to the expected offset. This avoids singularities and imprecision in the calculation and ensures that when applying rotations to the
GC
, the drawing figures are as expected.The snippet in #787 allows to play around with the offset behavior in different transformation scenarios and to compare it with the existing behavior if once started with the existing and once with the code proposed in this PR.
The PR includes the fix for all three SWT implementations and provides a regression test for the existing singularity that fails without the fix. It also adds a snippet for demonstrating the original bug and the effects of this change.
Fixes #788.