From ac5271600d12c3c05fee4ae0c9d9fd882a11ea69 Mon Sep 17 00:00:00 2001 From: treeform Date: Fri, 22 Jul 2022 11:02:16 -0700 Subject: [PATCH 1/2] Fix non simd magnifyBy2 --- src/pixie/masks.nim | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pixie/masks.nim b/src/pixie/masks.nim index 6856ba6..1af5235 100644 --- a/src/pixie/masks.nim +++ b/src/pixie/masks.nim @@ -152,18 +152,17 @@ proc magnifyBy2*(mask: Mask, power = 1): Mask {.raises: [PixieError].} = x += 16 for x in x ..< mask.width: let - value = mask.unsafe[x, y div scale] - scaledX = x * scale - idx = result.dataIndex(scaledX, y) + value = mask.unsafe[x, y] + resultIdx = result.dataIndex(x * scale, y * scale) for i in 0 ..< scale: - result.data[idx + i] = value - # Copy that row of values into (scale - 1) more rows + result.data[resultIdx + i] = value + # Copy that row of pixels into (scale - 1) more rows let rowStart = result.dataIndex(0, y * scale) for i in 1 ..< scale: copyMem( result.data[rowStart + result.width * i].addr, result.data[rowStart].addr, - result.width * 4 + result.width ) proc applyOpacity*(target: Mask, opacity: float32) {.hasSimd, raises: [].} = From 21ac6af59a71595c198c0de8651d57c06f838ca4 Mon Sep 17 00:00:00 2001 From: treeform Date: Fri, 22 Jul 2022 11:04:18 -0700 Subject: [PATCH 2/2] f --- src/pixie/masks.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pixie/masks.nim b/src/pixie/masks.nim index 1af5235..365bc2c 100644 --- a/src/pixie/masks.nim +++ b/src/pixie/masks.nim @@ -156,7 +156,7 @@ proc magnifyBy2*(mask: Mask, power = 1): Mask {.raises: [PixieError].} = resultIdx = result.dataIndex(x * scale, y * scale) for i in 0 ..< scale: result.data[resultIdx + i] = value - # Copy that row of pixels into (scale - 1) more rows + # Copy that row of values into (scale - 1) more rows let rowStart = result.dataIndex(0, y * scale) for i in 1 ..< scale: copyMem(