Skip to content

Commit

Permalink
Refine line hatch pattern width calculation on non-high-DPI screens
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnovak committed Jul 20, 2024
1 parent 766604e commit 01b5cc5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/drawlevel.nim
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,17 @@ proc renderLineHatchPatterns(dp; vg: NVGContext, scaleFactor, pxRatio: float,
{ifRepeatX, ifRepeatY}
):
var sw: float
# TODO refine
if pxRatio == 1.0:

if scaleFactor == 1.0 and pxRatio == 1.0:
# Make hatch patterns appear sharper on non-high-DPI displays
if spacing <= 4:
sw = 1.0
vg.shapeAntiAlias(false)
else:
sw = 0.8
else:
sw = 2.0
# On high-DPI displays, pxRatio is at least 2.0
sw = pxRatio

sw *= scaleFactor

Expand Down

0 comments on commit 01b5cc5

Please sign in to comment.