commit 1921219eb7606c0be7ad940380514555a933bde6
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed May 3 21:53:25 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Wed May 3 21:53:25 2017 +0200
Minor rewrite of blind-single-colour.c
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/src/blind-single-colour.c b/src/blind-single-colour.c
index 2a6511d..8eb25b9 100644
--- a/src/blind-single-colour.c
+++ b/src/blind-single-colour.c
_AT_@ -13,7 +13,7 @@ typedef double pixel_t[4];
int
main(int argc, char *argv[])
{
- struct stream stream;
+ struct stream stream = { .width = 0, .height = 0, .frames = 1 };
double X, Y, Z, alpha = 1;
size_t x, y, n;
pixel_t buf[BUFSIZ / 4];
_AT_@ -21,10 +21,6 @@ main(int argc, char *argv[])
int inf = 0;
char *arg;
- stream.width = 0;
- stream.height = 0;
- stream.frames = 1;
-
ARGBEGIN {
case 'f':
arg = UARGF();
_AT_@ -71,18 +67,12 @@ main(int argc, char *argv[])
buf[x][2] = Z;
buf[x][3] = alpha;
}
- while (inf || stream.frames--) {
- for (y = stream.height; y--;) {
- for (x = stream.width; x;) {
- x -= n = MIN(ELEMENTSOF(buf), x);
- for (n *= sizeof(*buf); n; n -= (size_t)r) {
- r = write(STDOUT_FILENO, buf, n);
- if (r < 0)
+ while (inf || stream.frames--)
+ for (y = stream.height; y--;)
+ for (x = stream.width * sizeof(*buf); x;)
+ for (x -= n = MIN(sizeof(buf), x); n; n -= (size_t)r)
+ if ((r = write(STDOUT_FILENO, buf, n)) < 0)
eprintf("write <stdout>:");
- }
- }
- }
- }
return 0;
}
Received on Wed May 03 2017 - 22:29:48 CEST
This archive was generated by hypermail 2.3.0
: Wed May 03 2017 - 22:36:22 CEST