diff options
author | June McEnroe <june@causal.agency> | 2018-09-05 01:45:07 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-09-05 01:45:07 -0400 |
commit | 76d45e4daa9d85f6dfef915ce6f37d39030287f3 (patch) | |
tree | 70521ad5b884ca25e551fb21b5ed0e6e53274412 | |
parent | Simplify glitch -x -y to just zero (diff) | |
download | src-76d45e4daa9d85f6dfef915ce6f37d39030287f3.tar.gz src-76d45e4daa9d85f6dfef915ce6f37d39030287f3.zip |
Zero after mirror
-rw-r--r-- | bin/glitch.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bin/glitch.c b/bin/glitch.c index b7b26213..793cb508 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) { |