commit 39049e695e28d31d895cdcde2f816bf5195cfdc6
parent 4246933e6434c7710e7954d5f616dc774006db64
Author: lumidify <nobody@lumidify.org>
Date:   Wed,  6 Jan 2021 21:07:24 +0100
Make image loading fail early
Diffstat:
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/TODO b/TODO
@@ -1 +1,5 @@
-Proper path handling (allow paths including "'", etc.)
+* Proper path handling (allow paths including "'", etc.)
+* Double-buffering
+* Draw pixmap on exposure events instead of doing the
+  expensive image resizing each time (goes hand-in-hand
+  with double-buffering)
diff --git a/croptool.1 b/croptool.1
@@ -88,7 +88,7 @@ Switch the color of the cropping rectangle between the primary and secondary col
 .It DELETE
 Delete the cropping rectangle of the current image.
 .It SPACE
-Redraw the window. This is useful when automatic resizing is disabled with
+Redraw the window. This is useful when automatic redrawing is disabled with
 .Fl m .
 .El
 .Sh MOUSE ACTIONS
diff --git a/croptool.c b/croptool.c
@@ -805,7 +805,7 @@ next_picture(int copy_box) {
 	/* loop until we find a loadable file */
 	while (!tmp_image && tmp_cur_selection + 1 < state.num_files) {
 		tmp_cur_selection++;
-		tmp_image = imlib_load_image(state.filenames[tmp_cur_selection]);
+		tmp_image = imlib_load_image_immediately(state.filenames[tmp_cur_selection]);
 		if (!tmp_image) {
 			fprintf(stderr, "Warning: Unable to load image '%s'.\n",
 			    state.filenames[tmp_cur_selection]);
@@ -831,7 +831,7 @@ last_picture(void) {
 	/* loop until we find a loadable file */
 	while (!tmp_image && tmp_cur_selection > 0) {
 		tmp_cur_selection--;
-		tmp_image = imlib_load_image(state.filenames[tmp_cur_selection]);
+		tmp_image = imlib_load_image_immediately(state.filenames[tmp_cur_selection]);
 		if (!tmp_image) {
 			fprintf(stderr, "Warning: Unable to load image '%s'.\n",
 			    state.filenames[tmp_cur_selection]);
diff --git a/croptool_crop.c b/croptool_crop.c
@@ -31,6 +31,7 @@ main(int argc, char *argv[]) {
 		fprintf(stderr, "USAGE: croptool_crop WIDTHxHEIGHT+X+Y FILENAME\n");
 		exit(1);
 	}
+	/* FIXME: proper error checking for this (don't use sscanf) */
 	if (sscanf(argv[1], "%dx%d+%d+%d", &w, &h, &x, &y) < 4) {
 		fprintf(stderr, "Invalid cropping rectangle specified.\n");
 		exit(1);