aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
commit38764943e5fc61c424c018068dc7f6790dddf147 (patch)
tree65a0f5a00c91436b30e580f16365557437d61da7 /src/render.c
parent0e7b2e49585e3725736ae380cbd2dfb28fea5093 (diff)
Format repass.
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/src/render.c b/src/render.c
index a4ed262..66db0c4 100644
--- a/src/render.c
+++ b/src/render.c
@@ -9,28 +9,31 @@
#define BLOCK_FLAG 0x40
#define IP_FLAG 0x80
-static void apply_flag(uint32 origin, uint32 max_pos, uint32 cell_size,
- uint32 address, uint32 flag, uint8_p buffer)
-{
+static void apply_flag(
+ uint32 origin, uint32 max_pos, uint32 cell_size, uint32 address,
+ uint32 flag, uint8_p buffer
+) {
if (address >= origin && address < max_pos) {
- /* Flag falls inside rendered image. We can 'and' the bit to the
- corresponding pixel.
+ /*
+ * Flag falls inside rendered image. We can 'and' the bit to the
+ * corresponding pixel.
*/
uint32 pixel = (address - origin) / cell_size;
buffer[pixel] |= flag;
}
}
-void sal_ren_get_image(uint32 origin, uint32 cell_size, uint32 buff_size,
- uint8_p buffer)
-{
- /* Render a 1D image of a given section of memory, at a given resolution
- (zoom) and store it in a pre-allocated 'buffer'.
-
- On the Salis python handler we draw memory as a 1D 'image' on the WORLD
- page. If we were to render this image directly on python, it would be
- excruciatingly slow, as we have to iterate over large areas of memory!
- Therefore, this memory module comes with a built-in, super fast renderer.
+void sal_ren_get_image(
+ uint32 origin, uint32 cell_size, uint32 buff_size, uint8_p buffer
+) {
+ /*
+ * Render a 1D image of a given section of memory, at a given resolution
+ * (zoom) and store it in a pre-allocated 'buffer'.
+ *
+ * On the Salis python handler we draw memory as a 1D 'image' on the WORLD
+ * page. If we were to render this image directly on python, it would be
+ * excruciatingly slow, as we have to iterate over large areas of memory!
+ * Therefore, this memory module comes with a built-in, super fast renderer.
*/
uint32 i;
uint32 max_pos;
@@ -40,8 +43,9 @@ void sal_ren_get_image(uint32 origin, uint32 cell_size, uint32 buff_size,
assert(buff_size);
assert(buffer);
- /* We make use of openmp for multi-threaded looping. This allows even
- faster render times, wherever openmp is supported.
+ /*
+ * We make use of openmp for multi-threaded looping. This allows even faster
+ * render times, wherever openmp is supported.
*/
#pragma omp parallel for
for (i = 0; i < buff_size; i++) {
@@ -68,8 +72,9 @@ void sal_ren_get_image(uint32 origin, uint32 cell_size, uint32 buff_size,
buffer[i] |= (uint8)(alloc_flag);
}
- /* We also iterate through all processes and append extra bit flags to the
- rendered image signaling process IP position and memory block limits.
+ /*
+ * We also iterate through all processes and append extra bit flags to the
+ * rendered image signaling process IP position and memory block limits.
*/
max_pos = origin + (cell_size * buff_size);
@@ -78,12 +83,14 @@ void sal_ren_get_image(uint32 origin, uint32 cell_size, uint32 buff_size,
if (!sal_proc_is_free(i)) {
Process proc = sal_proc_get_proc(i);
apply_flag(origin, max_pos, cell_size, proc.ip, IP_FLAG, buffer);
- apply_flag(origin, max_pos, cell_size, proc.mb1a, BLOCK_FLAG,
- buffer);
+ apply_flag(
+ origin, max_pos, cell_size, proc.mb1a, BLOCK_FLAG, buffer
+ );
if (proc.mb2s) {
- apply_flag(origin, max_pos, cell_size, proc.mb2a, BLOCK_FLAG,
- buffer);
+ apply_flag(
+ origin, max_pos, cell_size, proc.mb2a, BLOCK_FLAG, buffer
+ );
}
}
}