Break out of both loops.
This commit is contained in:
parent
547f321233
commit
13092aef5e
1 changed files with 9 additions and 8 deletions
|
@ -365,14 +365,15 @@ proc spread*(image: Image, spread: float32): Image =
|
||||||
for y in 0 ..< result.height:
|
for y in 0 ..< result.height:
|
||||||
for x in 0 ..< result.width:
|
for x in 0 ..< result.width:
|
||||||
var maxAlpha = 0.uint8
|
var maxAlpha = 0.uint8
|
||||||
for bx in -spread.int .. spread.int:
|
block blurBox:
|
||||||
for by in -spread.int .. spread.int:
|
for bx in -spread.int .. spread.int:
|
||||||
# if vec2(bx.float32, by.float32).length < spread:
|
for by in -spread.int .. spread.int:
|
||||||
let alpha = image[x + bx, y + by].a
|
# if vec2(bx.float32, by.float32).length < spread:
|
||||||
if alpha > maxAlpha:
|
let alpha = image[x + bx, y + by].a
|
||||||
maxAlpha = alpha
|
if alpha > maxAlpha:
|
||||||
if maxAlpha == 255:
|
maxAlpha = alpha
|
||||||
break
|
if maxAlpha == 255:
|
||||||
|
break blurBox
|
||||||
result[x, y] = rgba(0, 0, 0, maxAlpha)
|
result[x, y] = rgba(0, 0, 0, maxAlpha)
|
||||||
|
|
||||||
proc shadow*(
|
proc shadow*(
|
||||||
|
|
Loading…
Reference in a new issue