[win32] Refresh GC handle when related image #2263
Merged
+121
−83
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.
This PR adapts the behavior of the commonly used pattern of a GC that draw onto a plain image. In the windows implementation the monitor specific scaling could lead to issues with this pattern, because during creation time of an GC/Image combo it was not always clear with which zoom the final result will be drawn upon. This commit will redraw the GC on an image handle if a new zoom is requested. The handle for the old zoom of the image will be kept, but if another operation of the GC is executed it will only be applied on the new handle.
How to test
You can use this small windows specific snippet to force an image redraw with a different zoom
Before
If the image was used with a GC the same ImageData were used for all zooms

After
Left image is drawn for 150%, right is redrawn for 200%

This PR relies upon #2243 and must be merged after it. Only the latest commit is part of this PR