summary refs log tree commit diff
path: root/bin/glitch.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-05 01:45:07 -0400
committerJune McEnroe <june@causal.agency>2018-09-05 01:45:07 -0400
commit7f73ae089e76411d728e8da8630f6a8404fc8f7d (patch)
tree7774e842a9ebc5bddc001a81ca3b5050de0718b5 /bin/glitch.c
parentSimplify glitch -x -y to just zero (diff)
downloadsrc-7f73ae089e76411d728e8da8630f6a8404fc8f7d.tar.gz
src-7f73ae089e76411d728e8da8630f6a8404fc8f7d.zip
Zero after mirror
Diffstat (limited to 'bin/glitch.c')
-rw-r--r--bin/glitch.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/bin/glitch.c b/bin/glitch.c
index fdd1716f..57e67059 100644
--- a/bin/glitch.c
+++ b/bin/glitch.c
@@ -278,10 +278,10 @@ static struct {
 	uint8_t applyFilter;
 	enum Filter declareFilters[255];
 	enum Filter applyFilters[255];
-	bool zeroX;
-	bool zeroY;
 	bool invert;
 	bool mirror;
+	bool zeroX;
+	bool zeroY;
 } options;
 
 struct Bytes {
@@ -402,17 +402,6 @@ static void filterData(void) {
 	}
 }
 
-static void zeroX(void) {
-	size_t pixelSize = lineSize() / header.width;
-	for (uint32_t y = 0; y < header.height; ++y) {
-		memset(lines[y]->data, 0, pixelSize);
-	}
-}
-
-static void zeroY(void) {
-	memset(lines[0]->data, 0, lineSize());
-}
-
 static void invert(void) {
 	for (uint32_t y = 0; y < header.height; ++y) {
 		for (size_t i = 0; i < lineSize(); ++i) {
@@ -431,6 +420,17 @@ static void mirror(void) {
 	}
 }
 
+static void zeroX(void) {
+	size_t pixelSize = lineSize() / header.width;
+	for (uint32_t y = 0; y < header.height; ++y) {
+		memset(lines[y]->data, 0, pixelSize);
+	}
+}
+
+static void zeroY(void) {
+	memset(lines[0]->data, 0, lineSize());
+}
+
 static void glitch(const char *inPath, const char *outPath) {
 	if (inPath) {
 		path = inPath;
@@ -450,10 +450,10 @@ static void glitch(const char *inPath, const char *outPath) {
 	scanlines();
 	reconData();
 	filterData();
-	if (options.zeroX) zeroX();
-	if (options.zeroY) zeroY();
 	if (options.invert) invert();
 	if (options.mirror) mirror();
+	if (options.zeroX) zeroX();
+	if (options.zeroY) zeroY();
 	free(lines);
 
 	if (outPath) {