Merge pull request #140 from guzba/master

quick optimization
This commit is contained in:
treeform 2021-02-26 09:04:56 -08:00 committed by GitHub
commit 489e9359ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1482,13 +1482,19 @@ proc fillPath*(
windingRule = wrNonZero,
) =
## Fills a path.
var mask = newMask(image.width, image.height)
var fill = newImage(image.width, image.height)
if paint.kind == pkSolid:
image.fillPath(path, paint.color)
return
let
mask = newMask(image.width, image.height)
fill = newImage(image.width, image.height)
mask.fillPath(parseSomePath(path), windingRule)
case paint.kind:
of pkSolid:
fill.fill(paint.color)
discard # Handled above
of pkImage:
fill.draw(paint.image, paint.imageMat)
of pkImageTiled:
@ -1514,7 +1520,7 @@ proc fillPath*(
paint.gradientStops
)
fill.draw(mask, blendMode = bmMask)
fill.draw(mask)
image.draw(fill, blendMode = paint.blendMode)
proc strokePath*(