summary refs log tree commit diff
path: root/gfx/brot.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-02 17:01:50 -0400
committerJune McEnroe <june@causal.agency>2018-09-02 17:01:50 -0400
commite0fdc4923fa09efb59f0cb1314bdf0c5b6163144 (patch)
treee2022b242a91e1459088100c639881b13a009a73 /gfx/brot.c
parentUse PascalCase for constants (diff)
downloadsrc-e0fdc4923fa09efb59f0cb1314bdf0c5b6163144.tar.gz
src-e0fdc4923fa09efb59f0cb1314bdf0c5b6163144.zip
Use PascalCase for constants in gfx
Diffstat (limited to 'gfx/brot.c')
-rw-r--r--gfx/brot.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gfx/brot.c b/gfx/brot.c
index 64efde4b..69f11e59 100644
--- a/gfx/brot.c
+++ b/gfx/brot.c
@@ -28,8 +28,12 @@
 
 #include "gfx.h"
 
-#define RGB(r, g, b) ((uint32_t)(r) << 16 | (uint32_t)(g) << 8 | (uint32_t)(b))
-#define GRAY(n) RGB(n, n, n)
+static uint32_t rgb(uint8_t r, uint8_t g, uint8_t b) {
+	return (uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b;
+}
+static uint32_t gray(uint8_t n) {
+	return rgb(n, n, n);
+}
 
 static double absSq(double complex z) {
 	return creal(z) * creal(z) + cimag(z) * cimag(z);
@@ -70,7 +74,7 @@ static void sample(uint32_t *buf, size_t width, size_t height) {
 
 static void color(uint32_t *buf, size_t width, size_t height) {
 	for (size_t i = 0; i < width * height; ++i) {
-		buf[i] = GRAY(255 * buf[i] / samples / samples / depth);
+		buf[i] = gray(255 * buf[i] / samples / samples / depth);
 	}
 }