-
Notifications
You must be signed in to change notification settings - Fork 162
Smooth Scaling Rounding error fix for win32 #62 #1913
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
Smooth Scaling Rounding error fix for win32 #62 #1913
Conversation
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.
We briefly discussed this in the call but I'd like to point it out here again: wouldn't it be better to fix the smooth scaling for all OSes instead of duplicating the logic in Image
(which makes it Windows-specific)?
Did you try fixing it for all OSes already? Did something break?
If it's just a matter of risk management, we can simply try and fix it in DPIUtil
and test in Linux and Mac too.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Show resolved
Hide resolved
22f378e
to
70d6c33
Compare
This commit contributes to fixing the implementation of Smooth scaling of the ImageData to get rid of the rounding errors because of multiple scale ups and downs with fractional scale factor. The commit replicates and modifies the DPIUtil::autoScaleImageData method implementation in Image class to adapt the same. contributes to eclipse-platform#62 and eclipse-platform#127
70d6c33
to
6f78753
Compare
Can you please share why the solution was to duplicate functionality? We now have the (almost?) same implementation inside |
We need to draw directly using pixel specific implementation and we cannot access that gc::drawImage usign pixels from DPIUtil. Moreover, DPIUtil uses intermediate scale ups ad downs so I moved it to the Image. Another idea will be to move the method to ImageData and call that from DPIUtil. But for that I need an API in ImageData for smooth scaling. (ImageData is in commons) |
But why is that specific to Windows? Shouldn't the functionality then be generally moved into the Image classes? |
It cannot be completely moved to Image because its not completely specific to Image but also Cursor and a few other places. |
Better option would be to move the smooth scaling block in the DPIUtil::autoScaleImageData to a new public method in ImageData class. There we can get rid of the rounding error. |
Doing that in ImageData would be best anyway since there are several consumers using ImageData#scaledTo, which will produce bad results even if smooth scaling is enabled. |
Then we should revert the commit and I'll create another PR with a new impl. |
This PR contributes to fixing the implementation of Smooth scaling of the ImageData to get rid of the rounding errors because of multiple scale ups and downs with fractional scale factor. The commit replicates and modifies the DPIUtil::autoScaleImageData method implementation in Image class to adapt the same.
contributes to
#62 and #127