diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-07-16 15:29:43 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-07-16 15:29:43 +0200 |
| commit | d05d162cb81664f292834fa5d48d623d2b6147a7 (patch) | |
| tree | 9d4252fcdfa2210613188d5c965514cfab6a8ec2 /src/blind-mosaic-edges.c | |
| parent | Use #include instead of #define (diff) | |
| download | blind-d05d162cb81664f292834fa5d48d623d2b6147a7.tar.gz blind-d05d162cb81664f292834fa5d48d623d2b6147a7.tar.bz2 blind-d05d162cb81664f292834fa5d48d623d2b6147a7.tar.xz | |
Misc code improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/blind-mosaic-edges.c')
| -rw-r--r-- | src/blind-mosaic-edges.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/src/blind-mosaic-edges.c b/src/blind-mosaic-edges.c index 3b9ff55..b59dbda 100644 --- a/src/blind-mosaic-edges.c +++ b/src/blind-mosaic-edges.c @@ -10,9 +10,7 @@ main(int argc, char *argv[]) int tiled_y = 0; struct stream stream; void *colours[2]; - char *buf; - char *edges; - char *here; + char *buf, *edges, *here; size_t i, n, x, y; int v; @@ -65,37 +63,37 @@ main(int argc, char *argv[]) x = i % stream.width; y = i / stream.width; - if (x != stream.width - 1 && - memcmp(here + stream.pixel_size, here, stream.pixel_size)) - goto at_edge; + if (x != stream.width - 1) { + if (memcmp(here + stream.pixel_size, here, stream.pixel_size)) + goto at_edge; + } else if (tiled_x) { + if (memcmp(here + stream.pixel_size - stream.row_size, here, stream.pixel_size)) + goto at_edge; + } - if (tiled_x && x == stream.width - 1 && - memcmp(here + stream.pixel_size - stream.row_size, here, stream.pixel_size)) - goto at_edge; + if (x) { + if (memcmp(here - stream.pixel_size, here, stream.pixel_size)) + goto at_edge; + } else if (tiled_x) { + if (memcmp(here + stream.row_size - stream.pixel_size, here, stream.pixel_size)) + goto at_edge; + } - if (x && - memcmp(here - stream.pixel_size, here, stream.pixel_size)) - goto at_edge; + if (y != stream.height - 1) { + if (memcmp(here + stream.row_size, here, stream.pixel_size)) + goto at_edge; + } else if (tiled_y) { + if (memcmp(here + stream.row_size - stream.frame_size, here, stream.pixel_size)) + goto at_edge; + } - if (tiled_x && !x && - memcmp(here + stream.row_size - stream.pixel_size, here, stream.pixel_size)) - goto at_edge; - - if (y != stream.height - 1 && - memcmp(here + stream.row_size, here, stream.pixel_size)) - goto at_edge; - - if (tiled_y && y == stream.height - 1 && - memcmp(here + stream.row_size - stream.frame_size, here, stream.pixel_size)) - goto at_edge; - - if (y && - memcmp(here - stream.row_size, here, stream.pixel_size)) - goto at_edge; - - if (tiled_y && !y && - memcmp(here + stream.frame_size - stream.row_size, here, stream.pixel_size)) - goto at_edge; + if (y) { + if (memcmp(here - stream.row_size, here, stream.pixel_size)) + goto at_edge; + } else if (tiled_y) { + if (memcmp(here + stream.frame_size - stream.row_size, here, stream.pixel_size)) + goto at_edge; + } continue; at_edge: |
