aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-skip-pattern.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-05-10 16:59:26 +0200
committerMattias Andrée <maandree@kth.se>2017-05-10 16:59:26 +0200
commit6b998b5ed066aeece1146fe245b35965319b3cbd (patch)
treec963b48fbefafcec89a4e4af238869a1cb51148e /src/blind-skip-pattern.c
parentblind-flip is optimal (diff)
downloadblind-6b998b5ed066aeece1146fe245b35965319b3cbd.tar.gz
blind-6b998b5ed066aeece1146fe245b35965319b3cbd.tar.bz2
blind-6b998b5ed066aeece1146fe245b35965319b3cbd.tar.xz
Cleaner code
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/blind-skip-pattern.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/blind-skip-pattern.c b/src/blind-skip-pattern.c
index 914bed4..e8eee0b 100644
--- a/src/blind-skip-pattern.c
+++ b/src/blind-skip-pattern.c
@@ -2,20 +2,18 @@
#include "stream.h"
#include "util.h"
-#include <inttypes.h>
#include <string.h>
-#include <unistd.h>
USAGE("(skipped-frames | +included-frames) ...")
static int
-process_frame(struct stream *stream, int include, size_t rown)
+process_frame(struct stream *stream, int include)
{
size_t h, n, m;
int anything = 0;
for (h = stream->height; h; h--) {
- for (n = rown; n; n -= m, anything = 1) {
+ for (n = stream->row_size; n; n -= m, anything = 1) {
if (!stream->ptr && !eread_stream(stream, n))
goto done;
m = MIN(stream->ptr, n);
@@ -37,7 +35,7 @@ main(int argc, char *argv[])
{
struct stream stream;
int i, include;
- size_t f, n, rown, total = 0;
+ size_t f, n, total = 0;
char *includes;
size_t *ns;
@@ -64,16 +62,15 @@ main(int argc, char *argv[])
total += (size_t)include;
}
- echeck_frame_size(stream.width, 1, stream.pixel_size, 0, stream.file);
- rown = stream.width * stream.pixel_size;
stream.frames = total;
+ echeck_dimensions(&stream, WIDTH, NULL);
fprint_stream_head(stdout, &stream);
efflush(stdout, "<stdout>");
for (i = 0;; i = (i + 1) % argc) {
include = (int)includes[i];
for (n = ns[i]; n--;)
- if (!process_frame(&stream, include, rown))
+ if (!process_frame(&stream, include))
goto done;
}