-
Notifications
You must be signed in to change notification settings - Fork 187
[win32] Set background color on all image handles #1910
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
[win32] Set background color on all image handles #1910
Conversation
fedejeanne
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.
I would like to have a concrete way to test this though.
Also:
- what was the bug that's being fixed?
- Is it a bug or simply an inconsistency in the API contract?
- Is there a test to make sure that an exception is thrown if
setBackground(...)is called twice? If not, can you add it? - Is there a test that makes sure that images created afterward maintain the background? If not, can you add it?
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
I didn't actively saw the issue somewhere as this functionality is not used very much, but we should be able to create an issue with a Snippet. I will have a look into that.
Yes, I can add one in the win32 specific tests
No, but I can add one |
This commit adapts the win32 implementation of Image, so ensure that the background color of an image is always set to all existing of later created image handles. Currently all handles that are created after the background color was set, would not receive the background color.
e941580 to
cc39aa1
Compare
@fedejeanne After having a more thorough look into the implementation I ran into the problem, that this functionality doesn't seem to have any (visible) effect anymore. I assume that was originally added to fix issues with transparency with older windows versions. I was not able to trigger any visible effect by this -> transparencyPixel always worked.
I don't really see a way to test that automatically. As it was not possible to create a manual test as well, I don't see a chance here.
I would rather push that to a separate PR or even leave it out. If there is no real use case of this functionality I don't see value in adding this. |
fedejeanne
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.
The changes look OK. One final question: is transparentColor even needed anymore? I see that it's only used outside of Image (in GC) but it looks to me as if it can be replaced by the newly added backgroundColor.
WDYT @akoch-yatta ?
There is quite a similar logic involved there. I am just a bit hesitant to do something like that, because I don't fully understand the whole logic there. |
This PR adapts the win32 implementation of Image, so ensure that the background color of an image is always set to all existing of later created image handles. Currently all handles that are created after the background color was set, would not receive the background color.
Prerequisite for