summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-31 09:39:56 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-31 09:40:14 +0200
commit3cc2c50bb8422fc738a5875048c06758af6ded76 (patch)
treead8c88c7e5ceecb6f098ac86b286856b6d00d830
parentd37ff6f9334f1243219dc6a3da27b198c0b145fe (diff)
major --thumbnails speed impromevents, new --thumb-redraw option
See ChangeLog / man/feh.1 "--thumb-redraw" for more
-rw-r--r--ChangeLog5
-rw-r--r--man/feh.118
-rw-r--r--src/options.c6
-rw-r--r--src/options.h1
-rw-r--r--src/thumbnail.c11
5 files changed, 40 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 78416e4..0fcdb90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@ git HEAD
* Fix blur mode (Ctrl + left mouse key)
* Center images in index/thumbnail mode relative to the text below them
* Support caching of "large" (up to 256x256 pixels) thumbnails
+ * New --thumb-redraw option as workaround to speed up thumbnail mode
+ (thumbnail mode redrawing is quite slow, so now a redraw only happens
+ every 10 thumbnails by default - can be changed with this option)
+ * Because of that: Major speed improvements for --thumbnails, especially
+ with cached thumbnails
Thu May 6 08:34:39 CEST 2010 Daniel Friesel <derf@chaosdorf.de>
diff --git a/man/feh.1 b/man/feh.1
index ea122a9..a56c533 100644
--- a/man/feh.1
+++ b/man/feh.1
@@ -443,6 +443,24 @@ is specified.
Set thumbnail height.
.It Cm -y , --thumb-width Ar pixels
Set thumbnail width.
+.It Cm --thumb-redraw Ar n
+Only relevant for
+.Cm --thumbnails :
+Redraw thumbnail window every
+.Ar n
+images. In
+.Nm
+<= 1.5, the thumbnail image used to be redrawn after every computed thumbnail
+.Pq so, it updated immediately .
+However, since the redrawing takes quite long
+.Pq especially for thumbnail mode on a large filelist ,
+this turned out to be a major performance penalty.
+As a workaround, the thumbnail image is redrawn every 10th image now by
+default. Set
+.Ar n No = 1
+to get the old behaviour,
+.Ar n No = 0
+will only redraw once all thumbnails are loaded.
.El
.
.Sh INDEX MODE OPTIONS
diff --git a/src/options.c b/src/options.c
index f967456..1f3ec76 100644
--- a/src/options.c
+++ b/src/options.c
@@ -52,6 +52,7 @@ void init_parse_options(int argc, char **argv)
opt.slideshow_delay = -1.0;
opt.thumb_w = 60;
opt.thumb_h = 60;
+ opt.thumb_redraw = 10;
opt.menu_font = estrdup(DEFAULT_MENU_FONT);
opt.font = estrdup(DEFAULT_FONT);
opt.image_bg = estrdup("default");
@@ -395,6 +396,7 @@ static void feh_parse_option_array(int argc, char **argv)
{"index-name", 1, 0, 230},
{"index-size", 1, 0, 231},
{"index-dim", 1, 0, 232},
+ {"thumb-redraw", 1, 0, 233},
{0, 0, 0, 0}
};
int optch = 0, cmdx = 0;
@@ -738,6 +740,9 @@ static void feh_parse_option_array(int argc, char **argv)
case 232:
opt.index_show_dim = atoi(optarg);
break;
+ case 233:
+ opt.thumb_redraw = atoi(optarg);
+ break;
default:
break;
}
@@ -963,6 +968,7 @@ void show_usage(void)
" a new viewing window\n"
" --cache-thumbnails Enable thumbnail caching for thumbnail mode.\n"
" Only works with thumbnails <= 256x256 pixels\n"
+" --thumb-redraw N Redraw thumbnail window every N images\n"
" -~, --thumb-title STRING Set window title for images opened from thumbnail mode.\n"
" Supports format specifiers, see there.\n"
" -I, --fullindex Same as index mode, but below each thumbnail you\n"
diff --git a/src/options.h b/src/options.h
index 4a275e9..5d11816 100644
--- a/src/options.h
+++ b/src/options.h
@@ -109,6 +109,7 @@ struct __fehoptions {
int thumb_h;
int limit_w;
int limit_h;
+ unsigned int thumb_redraw;
int reload;
int sort;
int debug_level;
diff --git a/src/thumbnail.c b/src/thumbnail.c
index fe36213..aa45688 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -71,6 +71,7 @@ void init_thumbnail_mode(void)
int index_image_width, index_image_height;
int x_offset_name = 0, x_offset_dim = 0, x_offset_size = 0;
char *s;
+ unsigned int thumb_counter = 0;
/* initialize thumbnail mode data */
td.im_main = NULL;
@@ -350,11 +351,19 @@ void init_thumbnail_mode(void)
last = l;
}
if (opt.display) {
- winwidget_render_image(winwid, 0, 0);
+ /* thumb_counter is unsigned, so no need to catch overflows */
+ if (++thumb_counter == opt.thumb_redraw) {
+ winwidget_render_image(winwid, 0, 0);
+ thumb_counter = 0;
+ }
if (!feh_main_iteration(0))
exit(0);
}
}
+
+ if (thumb_counter != 0)
+ winwidget_render_image(winwid, 0, 0);
+
if (opt.verbose)
fprintf(stdout, "\n");