Fix: link overlay line width on HiDPI displays #10064
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.
Motivation / Problem
On HiDPI displays we draw the game at double resolution (GUI scale) to get a consistent physical GUI size. The link graph overlay uses a hard-coded line width of 3 pixels which is not adjusted for GUI scale. This makes the overlay's lines difficult to see, especially to distinguish the different saturation colours. Similar to #9997 this now uses the GUI scaling to translate these 3px to whatever is appropriate for the current GUI scaling level.
Description
Expected:
Actual (12.2):
Fix:
Limitations
LinkGraphOverlay
is initialized on map load. As the GUI scale can be changed in-game, we need to postpone scale the line width to the latest moment possible: on draw.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
* The bug fix is important enough to be backported? (label: 'backport requested')This PR affects the NewGRF API? (label 'needs review: NewGRF')PR must be added to API tracker