Fix blending with bmMask.

This commit is contained in:
treeform 2021-06-18 15:19:37 -07:00
parent 5d3fed368c
commit b34f4260de

View file

@ -630,7 +630,7 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
# Determine where we should start and stop drawing in the y dimension # Determine where we should start and stop drawing in the y dimension
var yMin, yMax: int var yMin, yMax: int
if blendMode == bmIntersectMask: if blendMode == bmMask:
yMin = 0 yMin = 0
yMax = a.height yMax = a.height
else: else:
@ -662,7 +662,7 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
xMin = xMin.clamp(0, a.width) xMin = xMin.clamp(0, a.width)
xMax = xMax.clamp(0, a.width) xMax = xMax.clamp(0, a.width)
if blendMode == bmIntersectMask: if blendMode == bmMask:
if xMin > 0: if xMin > 0:
zeroMem(a.data[a.dataIndex(0, y)].addr, 4 * xMin) zeroMem(a.data[a.dataIndex(0, y)].addr, 4 * xMin)
@ -780,7 +780,7 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
srcPos += dx srcPos += dx
if blendMode == bmIntersectMask: if blendMode == bmMask:
if a.width - xMax > 0: if a.width - xMax > 0:
zeroMem(a.data[a.dataIndex(xMax, y)].addr, 4 * (a.width - xMax)) zeroMem(a.data[a.dataIndex(xMax, y)].addr, 4 * (a.width - xMax))