[Win32] Fix transparency when scaling images with transparentPixel #2615
+32
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, indexed images that used a transparentPixel (e.g. GIFs) could be implicitly promoted to an 8-bit alpha representation when the image was scaled (for example when switching to a 150% DPI monitor). That meant an image created eagerly at 100% would look correct, but after a zoom/monitor change it would be converted to alpha-based transparency; moving back to 100% then revealed a gray background because the transparency semantics had changed.
This change normalizes indexed images that advertise a transparentPixel during initialization: when no alpha is present we convert the indexed image to a direct 32-bit representation (preserving the mask/transparent semantics) rather than leaving conversion to happen lazily during scaling. By doing this in init(Device, ImageData) the transparency model remains consistent across zoom levels and monitor transitions.
Notes:
How to test
Result
Here's the preview how it looked before and after this PR change. 100 -> 150 -> 100
Before:

After

Fixes: #2494