Commit 14a9702b authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Merge branch 'ulteq-dimension-pruning-without-preload'

parents 4abbd21f 5e75b5ef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ void init_list_mode(void);
void init_loadables_mode(void);
void init_unloadables_mode(void);
void feh_clean_exit(void);
int feh_should_ignore_image(Imlib_Image * im);
int feh_load_image(Imlib_Image * im, feh_file * file);
void show_mini_usage(void);
void slideshow_change_image(winwidget winwid, int change, int render);
+11 −3
Original line number Diff line number Diff line
@@ -464,9 +464,17 @@ int feh_cmp_format(void *file1, void *file2)

void feh_prepare_filelist(void)
{
	if (opt.list || opt.customlist || (opt.sort > SORT_MTIME)
			|| opt.preload || opt.min_width || opt.min_height
			|| (opt.max_width != UINT_MAX) || (opt.max_height != UINT_MAX)) {
	/*
	 * list and customlist mode as well as the somewhat more fancy sort modes
	 * need access to file infos. Preloading them is also useful for
	 * list/customlist as --min-dimension/--max-dimension may filter images
	 * which should not be processed.
	 * Finally, if --min-dimension/--max-dimension (-> opt.filter_by_dimensions)
	 * is set and we're in thumbnail mode, we need to filter images first so
	 * we can create a properly sized thumbnail list.
	 */
	if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME)
			|| (opt.filter_by_dimensions && (opt.index || opt.collage || opt.thumbs || opt.bgmode))) {
		/* For these sort options, we have to preload images */
		filelist = feh_file_info_preload(filelist);
		if (!gib_list_length(filelist))
+12 −0
Original line number Diff line number Diff line
@@ -139,6 +139,18 @@ void init_x_and_imlib(void)
	return;
}

int feh_should_ignore_image(Imlib_Image * im)
{
	if (opt.filter_by_dimensions) {
		unsigned int w = gib_imlib_image_get_width(im);
		unsigned int h = gib_imlib_image_get_height(im);
		if (w < opt.min_width || w > opt.max_width || h < opt.min_height || h > opt.max_height) {
			return 1;
		}
	}
	return 0;
}

int feh_load_image_char(Imlib_Image * im, char *filename)
{
	feh_file *file;
+2 −0
Original line number Diff line number Diff line
@@ -433,6 +433,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
			opt.debug = 1;
			break;
		case '<':
			opt.filter_by_dimensions = 1;
			XParseGeometry(optarg, &discard, &discard, &opt.max_width, &opt.max_height);
			if (opt.max_width == 0)
				opt.max_width = UINT_MAX;
@@ -440,6 +441,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
				opt.max_height = UINT_MAX;
			break;
		case '>':
			opt.filter_by_dimensions = 1;
			XParseGeometry(optarg, &discard, &discard, &opt.min_width, &opt.min_height);
			break;
		case '.':
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ struct __fehoptions {
	unsigned char no_fehbg;
	unsigned char keep_zoom_vp;
	unsigned char insecure_ssl;
	unsigned char filter_by_dimensions;

	char *output_file;
	char *output_dir;
Loading