diff --git a/src/pixie/contexts.nim b/src/pixie/contexts.nim index f8e41fa..503674d 100644 --- a/src/pixie/contexts.nim +++ b/src/pixie/contexts.nim @@ -312,13 +312,11 @@ proc clip*(ctx: Context, path: Path, windingRule = wrNonZero) = ## Turns the path into the current clipping region. The previous clipping ## region, if any, is intersected with the current or given path to create ## the new clipping region. - let mask = newMask(ctx.image.width, ctx.image.height) - mask.fillPath(path, ctx.mat, windingRule) - if ctx.mask == nil: - ctx.mask = mask + ctx.mask = newMask(ctx.image.width, ctx.image.height) + ctx.mask.fillPath(path, windingRule = windingRule) else: - ctx.mask.draw(mask, blendMode = bmMask) + ctx.mask.fillPath(path, windingRule = windingRule, blendMode = bmMask) proc clip*(ctx: Context, windingRule = wrNonZero) {.inline.} = ## Turns the current path into the current clipping region. The previous diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index c911417..ba04f0c 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1230,6 +1230,8 @@ proc computeCoverages( proc clearUnsafe(target: Image | Mask, startX, startY, toX, toY: int) = ## Clears data from [start, to). + if startX == target.width or startY == target.height: + return let start = target.dataIndex(startX, startY) len = target.dataIndex(toX, toY) - start