diff options
Diffstat (limited to 'src/blind-linear-gradient.c')
| -rw-r--r-- | src/blind-linear-gradient.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/blind-linear-gradient.c b/src/blind-linear-gradient.c index 57cde3c..55711ac 100644 --- a/src/blind-linear-gradient.c +++ b/src/blind-linear-gradient.c @@ -36,12 +36,7 @@ main(int argc, char *argv[]) eopen_stream(&stream, NULL); - if (!strcmp(stream.pixfmt, "xyza")) - process = process_lf; - else if (!strcmp(stream.pixfmt, "xyza f")) - process = process_f; - else - eprintf("pixel format %s is not supported, try xyza\n", stream.pixfmt); + SELECT_PROCESS_FUNCTION(&stream); if (stream.width > 2 || stream.height > 2 || stream.width * stream.height != 2) eprintf("<stdin>: each frame must contain exactly 2 pixels\n"); @@ -63,7 +58,7 @@ PROCESS(struct stream *stream) pixel_t buf[BUFSIZ / sizeof(pixel_t)]; TYPE *params, x1, y1, x2, y2, norm2; TYPE x, y; - size_t ix, iy, ptr = 0; + size_t i, ix, iy, ptr = 0; for (;;) { while (stream->ptr < stream->frame_size) { @@ -91,7 +86,8 @@ PROCESS(struct stream *stream) x = (x * x2 + y * y2) / norm2; if (bilinear) x = abs(x); - buf[ptr][0] = buf[ptr][1] = buf[ptr][2] = buf[ptr][3] = x; + for (i = 0; i < stream->n_chan; i++) + buf[ptr][i] = x; if (++ptr == ELEMENTSOF(buf)) { ewriteall(STDOUT_FILENO, buf, sizeof(buf), "<stdout>"); ptr = 0; |
