simpler
This commit is contained in:
parent
39f6c47bc6
commit
1aa738c3a7
1 changed files with 8 additions and 11 deletions
|
@ -1506,7 +1506,6 @@ template walkHits(
|
||||||
y, width: int,
|
y, width: int,
|
||||||
inner: untyped
|
inner: untyped
|
||||||
) =
|
) =
|
||||||
var filledTo {.inject.}: int
|
|
||||||
for (prevAt, at, count) in hits.walk(numHits, windingRule, y, width):
|
for (prevAt, at, count) in hits.walk(numHits, windingRule, y, width):
|
||||||
let
|
let
|
||||||
fillStart {.inject.} = prevAt.integer
|
fillStart {.inject.} = prevAt.integer
|
||||||
|
@ -1514,8 +1513,6 @@ template walkHits(
|
||||||
if fillLen <= 0:
|
if fillLen <= 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
filledTo = fillStart + fillLen
|
|
||||||
|
|
||||||
inner
|
inner
|
||||||
|
|
||||||
proc fillHits(
|
proc fillHits(
|
||||||
|
@ -1555,18 +1552,18 @@ proc fillHits(
|
||||||
image.unsafe[x, y] = blendNormal(backdrop, rgbx)
|
image.unsafe[x, y] = blendNormal(backdrop, rgbx)
|
||||||
|
|
||||||
of MaskBlend:
|
of MaskBlend:
|
||||||
var prevFilledTo = startX
|
var filledTo = startX
|
||||||
walkHits hits, numHits, windingRule, y, image.width:
|
walkHits hits, numHits, windingRule, y, image.width:
|
||||||
block: # Clear any gap between this fill and the previous fill
|
block: # Clear any gap between this fill and the previous fill
|
||||||
let gapBetween = fillStart - prevFilledTo
|
let gapBetween = fillStart - filledTo
|
||||||
if gapBetween > 0:
|
if gapBetween > 0:
|
||||||
fillUnsafe(
|
fillUnsafe(
|
||||||
image.data,
|
image.data,
|
||||||
rgbx(0, 0, 0, 0),
|
rgbx(0, 0, 0, 0),
|
||||||
image.dataIndex(prevFilledTo, y),
|
image.dataIndex(filledTo, y),
|
||||||
gapBetween
|
gapBetween
|
||||||
)
|
)
|
||||||
prevFilledTo = filledTo
|
filledTo = fillStart + fillLen
|
||||||
block: # Handle this fill
|
block: # Handle this fill
|
||||||
if rgbx.a != 255:
|
if rgbx.a != 255:
|
||||||
var x = fillStart
|
var x = fillStart
|
||||||
|
@ -1599,12 +1596,12 @@ proc fillHits(
|
||||||
fillUnsafe(mask.data, 255, mask.dataIndex(fillStart, y), fillLen)
|
fillUnsafe(mask.data, 255, mask.dataIndex(fillStart, y), fillLen)
|
||||||
|
|
||||||
of MaskBlend:
|
of MaskBlend:
|
||||||
var prevFilledTo = startX
|
var filledTo = startX
|
||||||
walkHits hits, numHits, windingRule,y, mask.width:
|
walkHits hits, numHits, windingRule,y, mask.width:
|
||||||
let gapBetween = fillStart - prevFilledTo
|
let gapBetween = fillStart - filledTo
|
||||||
if gapBetween > 0:
|
if gapBetween > 0:
|
||||||
fillUnsafe(mask.data, 0, mask.dataIndex(prevFilledTo, y), gapBetween)
|
fillUnsafe(mask.data, 0, mask.dataIndex(filledTo, y), gapBetween)
|
||||||
prevFilledTo = filledTo
|
filledTo = fillStart + fillLen
|
||||||
|
|
||||||
mask.clearUnsafe(0, y, startX, y)
|
mask.clearUnsafe(0, y, startX, y)
|
||||||
mask.clearUnsafe(filledTo, y, mask.width, y)
|
mask.clearUnsafe(filledTo, y, mask.width, y)
|
||||||
|
|
Loading…
Reference in a new issue