summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2021-11-01 08:31:35 +0100
committerKim Woelders <kim@woelders.dk>2021-11-05 17:22:01 +0100
commit55a27d01f8e96a6c448cc3059c17e67453303461 (patch)
treeb76e3a2ea16071fc2a4c114586a3398a56509ece
parent0ef105d43c94f28613fd0a8ec0324cec33b14f58 (diff)
imlib2_view: Add option to cache images
-rw-r--r--src/bin/imlib2_view.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c
index 0e09c18..12af0f5 100644
--- a/src/bin/imlib2_view.c
+++ b/src/bin/imlib2_view.c
@@ -20,6 +20,7 @@ static int image_width = 0, image_height = 0;
20static int window_width = 0, window_height = 0; 20static int window_width = 0, window_height = 0;
21static Imlib_Image bg_im = NULL; 21static Imlib_Image bg_im = NULL;
22 22
23static char opt_cache = 0;
23static char opt_scale = 0; 24static char opt_scale = 0;
24static double opt_scale_x = 1.; 25static double opt_scale_x = 1.;
25static double opt_scale_y = 1.; 26static double opt_scale_y = 1.;
@@ -39,6 +40,7 @@ static int opt_progress_delay = 0;
39 "Usage:\n" \ 40 "Usage:\n" \
40 " imlib2_view [OPTIONS] FILE...\n" \ 41 " imlib2_view [OPTIONS] FILE...\n" \
41 "OPTIONS:\n" \ 42 "OPTIONS:\n" \
43 " -c : Enable image caching\n" \
42 " -d : Enable debug\n" \ 44 " -d : Enable debug\n" \
43 " -g N: Set progress granularity to N%% (default 10(%%))\n" \ 45 " -g N: Set progress granularity to N%% (default 10(%%))\n" \
44 " -l N: Introduce N ms delay in progress callback (default 0)\n" \ 46 " -l N: Introduce N ms delay in progress callback (default 0)\n" \
@@ -185,10 +187,13 @@ main(int argc, char **argv)
185 187
186 verbose = 0; 188 verbose = 0;
187 189
188 while ((opt = getopt(argc, argv, "dg:l:ps:v")) != -1) 190 while ((opt = getopt(argc, argv, "cdg:l:ps:v")) != -1)
189 { 191 {
190 switch (opt) 192 switch (opt)
191 { 193 {
194 case 'c':
195 opt_cache = 1;
196 break;
192 case 'd': 197 case 'd':
193 debug += 1; 198 debug += 1;
194 break; 199 break;
@@ -412,7 +417,8 @@ main(int argc, char **argv)
412 zoom = 1.0; 417 zoom = 1.0;
413 zoom_mode = 0; 418 zoom_mode = 0;
414 imlib_context_set_image(im); 419 imlib_context_set_image(im);
415 imlib_free_image_and_decache(); 420 if (!opt_cache)
421 imlib_free_image_and_decache();
416 no = no2; 422 no = no2;
417 im = im2; 423 im = im2;
418 imlib_context_set_image(im); 424 imlib_context_set_image(im);