From: Colin Clark Date: Thu, 2 Sep 2021 11:55:20 +0000 (+0100) Subject: User option to set tile size X-Git-Tag: v1.7~65 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=8205d63c3fd19d6db15cc0285b10aae63f270802 User option to set tile size Additional user option in Edit/Preferences/Image to set the tile size. --- diff --git a/doc/docbook/GuideOptionsImage.xml b/doc/docbook/GuideOptionsImage.xml index ed44bea9..446e3120 100644 --- a/doc/docbook/GuideOptionsImage.xml +++ b/doc/docbook/GuideOptionsImage.xml @@ -102,6 +102,21 @@ +
+ Tile Size + + + + Tile size in pixels + + + + This option is only available when GPU acceleration is not selected. It sets the size in pixels that large images are split into during rendering. Setting a larger value will reduce the tiling effect seen as the image is displayed, but will also slightly increase the delay until the first part of the image is seen. + + + + +
Appearance diff --git a/src/options.c b/src/options.c index 8f9cb7cb..c4fca52a 100644 --- a/src/options.c +++ b/src/options.c @@ -123,6 +123,7 @@ ConfOptions *init_options(ConfOptions *options) options->image.zoom_mode = ZOOM_RESET_NONE; options->image.zoom_quality = GDK_INTERP_BILINEAR; options->image.zoom_to_fit_allow_expand = FALSE; + options->image.tile_size = 128; options->image_overlay.template_string = NULL; options->image_overlay.x = 10; diff --git a/src/options.h b/src/options.h index 5ba51dd4..c9623d9d 100644 --- a/src/options.h +++ b/src/options.h @@ -153,6 +153,8 @@ struct _ConfOptions GdkColor border_color; GdkColor alpha_color_1; GdkColor alpha_color_2; + + gint tile_size; } image; /* thumbnails */ diff --git a/src/preferences.c b/src/preferences.c index 4546b1dc..65cf4d6e 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -286,6 +286,7 @@ static void config_window_apply(void) options->image.max_autofit_size = c_options->image.max_autofit_size; options->image.max_enlargement_size = c_options->image.max_enlargement_size; options->image.use_clutter_renderer = c_options->image.use_clutter_renderer; + options->image.tile_size = c_options->image.tile_size; options->progressive_key_scrolling = c_options->progressive_key_scrolling; options->keyboard_scroll_step = c_options->keyboard_scroll_step; @@ -2286,6 +2287,15 @@ static void config_tab_image(GtkWidget *notebook) pref_checkbox_link_sensitivity(ct_button, spin); gtk_widget_set_tooltip_text(GTK_WIDGET(hbox), _("This value will set the virtual size of the window when \"Fit image to window\" is set. Instead of using the actual size of the window, the specified percentage of the window will be used. It allows one to keep a border around the image (values lower than 100%) or to auto zoom the image (values greater than 100%). It affects fullscreen mode too.")); + group = pref_group_new(vbox, FALSE, _("Tile size"), GTK_ORIENTATION_VERTICAL); + gtk_widget_set_sensitive(group, !options->image.use_clutter_renderer); + + hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); + spin = pref_spin_new_int(hbox, _("Pixels"), _("(Requires restart)"), + 128, 4096, 128, + options->image.tile_size, &c_options->image.tile_size); + gtk_widget_set_tooltip_text(GTK_WIDGET(hbox), _("This value changes the size of the tiles large images are split into. Increasing the size of the tiles will reduce the tiling effect seen on image changes, but will also slightly increase the delay before the first part of a large image is seen.")); + group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Use custom border color in window mode"), diff --git a/src/rcfile.c b/src/rcfile.c index feaca6ef..aeb949a9 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -399,6 +399,7 @@ static void write_global_attributes(GString *outstr, gint indent) WRITE_NL(); WRITE_COLOR(*options, image.alpha_color_1); WRITE_NL(); WRITE_COLOR(*options, image.alpha_color_2); WRITE_NL(); WRITE_BOOL(*options, image.use_clutter_renderer); + WRITE_NL(); WRITE_INT(*options, image.tile_size); /* Thumbnails Options */ WRITE_NL(); WRITE_INT(*options, thumbnails.max_width); @@ -882,6 +883,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar ** if (READ_COLOR(*options, image.alpha_color_1)) continue; if (READ_COLOR(*options, image.alpha_color_2)) continue; if (READ_BOOL(*options, image.use_clutter_renderer)) continue; + if (READ_INT(*options, image.tile_size)) continue; /* Thumbnails options */ if (READ_INT_CLAMP(*options, thumbnails.max_width, 16, 512)) continue; diff --git a/src/renderer-tiles.c b/src/renderer-tiles.c index e9938960..9b671759 100644 --- a/src/renderer-tiles.c +++ b/src/renderer-tiles.c @@ -58,10 +58,6 @@ typedef enum { } ExifOrientationType; #endif - -/* size to use when breaking up image pane for rendering */ -#define PR_TILE_SIZE 128 - typedef struct _ImageTile ImageTile; typedef struct _QueueData QueueData; @@ -501,7 +497,7 @@ static gint pixmap_calc_size(cairo_surface_t *surface) // d = gdk_drawable_get_depth(pixmap); // gdk_drawable_get_size(pixmap, &w, &h); - return PR_TILE_SIZE * PR_TILE_SIZE * 4 / 8; + return options->image.tile_size * options->image.tile_size * 4 / 8; } static void rt_hidpi_aware_draw( @@ -2359,8 +2355,8 @@ RendererFuncs *renderer_tiles_new(PixbufRenderer *pr) rt->f.stereo_set = renderer_stereo_set; - rt->tile_width = PR_TILE_SIZE; - rt->tile_height = PR_TILE_SIZE; + rt->tile_width = options->image.tile_size; + rt->tile_height = options->image.tile_size; rt->tiles = NULL; rt->tile_cache_size = 0;