Merge pull request #396 from treeform/dev

Fix #394 - zero width mask fill.
This commit is contained in:
treeform 2022-03-18 13:43:32 -07:00 committed by GitHub
commit aeda891540
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -1679,6 +1679,9 @@ proc fillShapes(
pathHeight = min(mask.height, (bounds.y + bounds.h).int)
partitioning = partitionSegments(segments, startY, pathHeight)
if pathWidth == 0:
return
var
coverages = newSeq[uint8](pathWidth)
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)

View file

@ -675,3 +675,18 @@ block:
doAssertRaises PixieError:
ctx.strokePolygon(vec2(0.0, 0.0), 0.0, 0)
block:
# Test zero width image fill.
let
image = newImage(100, 100)
pathStr = "M0 0 L0 1 L0 0 Z"
color = rgba(255, 0, 0, 255)
image.fillPath(pathStr, color)
block:
# Test zero width mask fill.
let
mask = newMask(100, 100)
pathStr = "M0 0 L0 1 L0 0 Z"
mask.fillPath(pathStr)