For SVG icons, prefer Icon.paintIcon over Graphics.drawImage #8309
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.
Here are a few more changes to ensure that SVG icons render at full resolution on HiDPI screens.
This PR handles the transformation from
Graphics.drawImage(ImageIcon, x, y, null)to
Icon.paintIcon(null, Graphics, x, y)at various places in the codebase.
This fixes e.g. poor-resolution lightbulb icons in the editor gutter on Windows at fractional HiDPI scale factors. See the before/after screenshot below, which was taken on Windows 11 with the 150% HiDPI scaling level.
All simple such cases were found by grepping for "drawImage" and reviewing each case. Test classes and NBI related classes were skipped.
This is mostly an improvement for screens with a fractional HiDPI scaling (e.g. 150%) on Windows. On 200% scaling (including on MacOS), icons are drawn properly even with drawImage, due to ImageUtilities returning MultiResolutionImage instances nowadays with 1x and 2x resolutions present. The latter is still a good fallback for cases that may not yet be covered otherwise.