-
Notifications
You must be signed in to change notification settings - Fork 161
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
Rewrite the algorithm that sets smallIcon/largeIcon in Decorations class #1879
Rewrite the algorithm that sets smallIcon/largeIcon in Decorations class #1879
Conversation
Test Results 509 files ±0 509 suites ±0 10m 20s ⏱️ ±0s For more details on these failures, see this check. Results for commit 0892529. ± Comparison against base commit 7f381e8. ♻️ This comment has been updated with latest results. |
172580b
to
2089d41
Compare
Failing test is unrelated: #1843 |
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
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.
Simplifying this functionality and improve comprehensibility is a good thing.
I left some proposal for improving the code and making the logic comprehensible. Most essential for me would be to assign the compares values that are hard to understand (system metrics, image data at specific zooms) to comprehensive, self-explaining variables, as that's exactly the part that confused me all the time and made it difficult to understand what happens here.
Apart from that, formatting does currently seems to be broken at several places (in particular, missing whitespaces).
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
Outdated
Show resolved
Hide resolved
b4659b3
to
74f094a
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.
Definitely much cleaner and easier to understand now 👍
Once formatting is correct, I think this is good to go.
Don't sort, compare and keep the image that is closest to the desired dimensions, pixel transparency and pixel depth. The new method "isCloserThan" is based on the (now deleted) "compare" method and returns true only if "compare" would have returned -1 Reduce visibility of Decorations::setImages
99093d5
to
0892529
Compare
Perfect! 0892529 only changes the formatting of the affected code. I used |
Test failure is unrelated (test timeout) since the last change only changed formatting. Merging. |
The output is the same but the new algorithm doesn't sort and select the 1st one, it directly searches for the best one.