-
Notifications
You must be signed in to change notification settings - Fork 191
Fix GC#drawImage methods with additional Transformation #2934
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
base: master
Are you sure you want to change the base?
Fix GC#drawImage methods with additional Transformation #2934
Conversation
|
Have tested the changes myself and can see it fixes the said issue. |
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
Outdated
Show resolved
Hide resolved
f9c3b63 to
35f2d85
Compare
ad4b117 to
3264f8b
Compare
3264f8b to
be0c37d
Compare
be0c37d to
fca51c4
Compare
HeikoKlare
left a comment
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.
There is an attempt to fix the issue with wrongly scaled image data being used when a transform is applied for GEF:
We should check if that issue is resolved with this PR as well and there is also a snippet in there to may better test these changes.
| float scaleWidth = (float) Math.hypot(m[0], m[2]); | ||
| float scaleHeight = (float) Math.hypot(m[1], m[3]); |
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.
I think it would help to add a comment with an explanation of a link to some explaining source why this calculates the right scale values out of the matrix.
It's not that easy to understand as the matrix of course also contains a rotations, so I have to admit I do not easily understand if/why this calculation is the right one.
If a transform is applied via the GC, then both drawImage APIs consider now the best fitting handle by requesting it through the width/height of the full image scaled by the scaleFactor (relating destination width/height to source winowdth/height) times the width/height scaling induced by the transformation.
fca51c4 to
1cb3562
Compare
If a transform is applied via the GC, then both drawImage APIs consider now the best fitting handle by requesting it through the width/height of the full image scaled by the scaleFactor (relating destination width/height to source width/height) times the width/height scaling induced by the transformation.
Note that only the second commit is relevant for the PR. The first one references to the changes made in #2913.
To easily see and test, use the following snippet:
Below are screenshots of the snippet on a 100% zoom.
Before:

After:
