Created
April 1, 2021 21:46
-
-
Save GoldsteinE/181d3a587b58d7af0e6ab1642a89af6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/rivertile/main.zig b/rivertile/main.zig | |
index d1149b1..5e61686 100644 | |
--- a/rivertile/main.zig | |
+++ b/rivertile/main.zig | |
@@ -66,6 +66,17 @@ pub fn main() !void { | |
const output_width = try std.fmt.parseInt(u32, std.mem.spanZ(args[width_arg]), 10); | |
const output_height = try std.fmt.parseInt(u32, std.mem.spanZ(args[height_arg]), 10); | |
+ // Buffering the output makes things faster | |
+ var stdout_buf = std.io.bufferedOutStream(std.io.getStdOut().outStream()); | |
+ const stdout = stdout_buf.outStream(); | |
+ | |
+ // Smart gaps | |
+ if (num_views == 1) { | |
+ try stdout.print("{} {} {} {}\n", .{ 0, 0, output_width, output_height }); | |
+ try stdout_buf.flush(); | |
+ return; | |
+ } | |
+ | |
const secondary_count = if (num_views > main_count) num_views - main_count else 0; | |
// to make things pixel-perfect, we make the first main and first secondary | |
@@ -97,10 +108,6 @@ pub fn main() !void { | |
secondary_height_rem = output_height % secondary_count; | |
} | |
- // Buffering the output makes things faster | |
- var stdout_buf = std.io.bufferedOutStream(std.io.getStdOut().outStream()); | |
- const stdout = stdout_buf.outStream(); | |
- | |
var i: u32 = 0; | |
while (i < num_views) : (i += 1) { | |
var x: u32 = undefined; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment