[win32] Choose best Image handle drawing with GC #2138
Merged
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 commit adapts the drawImage method in GC in the windows implementation for copying and (probably) scaling an area from a source image into the GC target. With the Image supporting multiple handles now, the handle from the source image is no longer always chosen by the zoom context of the GC but sometimes from the target size, e.g. if an image should be drawn with a scale of 2 on a 100% monitor, it might provide better results to use an image handle fitting for 200%.
How to test
If you execute the Snippet below with and without the PR you should see something like below: left with this PR and right without this PR. Top row is simulating a GC on 100%, bottom row on 200% zoom. Scale factors for each of each of the three images are 1, 1.5 and 2, so100%, 150% and 200% on top and 200%, 300% and 400% in the bottom. Most images will remain as they were before, but you see a difference in the top row, image to the right. This PR proposes a simple first approach to improve drawing scaled variants of an Image with a GC. Testing another approach in #2134 had some disadvantages, that led us to the decision, to start with a rather simple approach and extend on that.