app: add "Swap compression" option to the preferences

Add a new "Swap compression" option to the preferences, allowing
explicit control over the tile-swap compression algorithm.
Previously, control over swap compression was only possible through
GEGL command-line options/environment variables.  Since the GEGL
API to list all available compression algorithms is still private
for now, we currently only list the three predefined compression
levels -- "best performance" (the default), "balanced", and "best
compression" -- and a "none" option, to disable compression
altogether.  Selecting a custom compression algorithm is possible
by entering its name manually.

(cherry picked from commit 1664ecbf1d)
This commit is contained in:
Ell
2019-09-22 16:44:23 +03:00
parent eb386d2d5e
commit d5e78f1899
13 changed files with 472 additions and 35 deletions

View File

@ -383,3 +383,20 @@ prefs_profile_combo_box_add (GObject *config,
return combo;
}
GtkWidget *
prefs_compression_combo_box_add (GObject *config,
const gchar *property_name,
const gchar *label,
GtkTable *table,
gint table_row,
GtkSizeGroup *group)
{
GtkWidget *combo = gimp_prop_compression_combo_box_new (config,
property_name);
if (combo)
prefs_widget_add_aligned (combo, label, table, table_row, FALSE, group);
return combo;
}

View File

@ -123,6 +123,12 @@ GtkWidget * prefs_profile_combo_box_add (GObject *config,
GtkSizeGroup *group,
GObject *profile_path_config,
const gchar *profile_path_property_name);
GtkWidget * prefs_compression_combo_box_add (GObject *config,
const gchar *property_name,
const gchar *label,
GtkTable *table,
gint table_row,
GtkSizeGroup *group);
#endif /* __PREFERENCES_DIALOG_H__ */

View File

@ -1172,9 +1172,9 @@ prefs_dialog_new (Gimp *gimp,
GTK_CONTAINER (vbox), FALSE);
#ifdef ENABLE_MP
table = prefs_table_new (5, GTK_CONTAINER (vbox2));
table = prefs_table_new (6, GTK_CONTAINER (vbox2));
#else
table = prefs_table_new (4, GTK_CONTAINER (vbox2));
table = prefs_table_new (5, GTK_CONTAINER (vbox2));
#endif /* ENABLE_MP */
prefs_spin_button_add (object, "undo-levels", 1.0, 5.0, 0,
@ -1190,10 +1190,14 @@ prefs_dialog_new (Gimp *gimp,
_("Maximum _new image size:"),
GTK_TABLE (table), 3, size_group);
prefs_compression_combo_box_add (object, "swap-compression",
_("S_wap compression:"),
GTK_TABLE (table), 4, size_group);
#ifdef ENABLE_MP
prefs_spin_button_add (object, "num-processors", 1.0, 4.0, 0,
_("Number of _threads to use:"),
GTK_TABLE (table), 4, size_group);
GTK_TABLE (table), 5, size_group);
#endif /* ENABLE_MP */
/* Hardware Acceleration */