From 2c2e35bff5b3e94702e07d35898dcd8be24fb193 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Sat, 11 Dec 2021 18:06:11 -0600 Subject: [PATCH] comments back --- src/pixie/masks.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pixie/masks.nim b/src/pixie/masks.nim index 0076a9a..affa6e3 100644 --- a/src/pixie/masks.nim +++ b/src/pixie/masks.nim @@ -45,9 +45,17 @@ template unsafe*(src: Mask): UnsafeMask = UnsafeMask(mask: src) template `[]`*(view: UnsafeMask, x, y: int): uint8 = + ## Gets a value from (x, y) coordinates. + ## * No bounds checking * + ## Make sure that x, y are in bounds. + ## Failure in the assumptions will case unsafe memory reads. view.mask.data[view.mask.dataIndex(x, y)] template `[]=`*(view: UnsafeMask, x, y: int, color: uint8) = + ## Sets a value from (x, y) coordinates. + ## * No bounds checking * + ## Make sure that x, y are in bounds. + ## Failure in the assumptions will case unsafe memory writes. view.mask.data[view.mask.dataIndex(x, y)] = color proc `[]`*(mask: Mask, x, y: int): uint8 {.inline, raises: [].} =