[win32] Choose best Image handle drawing with GC #2134
Draft
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 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 chosen by the zoom context of the GC but 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%.
Example use case for this method is e.g. in GEF, where the internal GEF zoom is used to scaled images drawn in a diagram.
The PR depends on #2120 being merged first.
How it looks
This is one exempt of the Snippet below

Each row is a different image, e.g. created via ImageData, ImageFileNameProvider, ImageDataProvider, etc. and the greyed and disabled variants.
Left column is the code in the PR, middle is the previous method, right is enabling advanced mode and using the previous method (just for comparison)
This does not use any SVG. With those the result will be of course way better. The screenshot is using the PNGs from Snippet382.
How to test
A small Snippet to see the different variants is elow. Prerequisite is to copy the old implementation into GC under a different name:
Snippet: