From 13092aef5ee573747439b7490cbf01355a995809 Mon Sep 17 00:00:00 2001 From: treeform Date: Wed, 2 Dec 2020 23:05:37 -0800 Subject: [PATCH] Break out of both loops. --- src/pixie/images.nim | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pixie/images.nim b/src/pixie/images.nim index 4039c41..6ecfcb8 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -365,14 +365,15 @@ proc spread*(image: Image, spread: float32): Image = for y in 0 ..< result.height: for x in 0 ..< result.width: var maxAlpha = 0.uint8 - for bx in -spread.int .. spread.int: - for by in -spread.int .. spread.int: - # if vec2(bx.float32, by.float32).length < spread: - let alpha = image[x + bx, y + by].a - if alpha > maxAlpha: - maxAlpha = alpha - if maxAlpha == 255: - break + block blurBox: + for bx in -spread.int .. spread.int: + for by in -spread.int .. spread.int: + # if vec2(bx.float32, by.float32).length < spread: + let alpha = image[x + bx, y + by].a + if alpha > maxAlpha: + maxAlpha = alpha + if maxAlpha == 255: + break blurBox result[x, y] = rgba(0, 0, 0, maxAlpha) proc shadow*(