removed "num_processors".

2001-05-25  Michael Natterer  <mitch@gimp.org>

	* app/gimprc.[ch]: removed "num_processors".

	* app/base/base-config.[ch]: and added it here.

	* app/base/gimphistogram.c
	* app/base/pixel-processor.c
	* app/gui/preferences-dialog.c: changed accordingly.
This commit is contained in:
Michael Natterer 2001-05-25 16:24:44 +00:00 committed by Michael Natterer
parent 746fc51973
commit 654aa93ef5
9 changed files with 45 additions and 28 deletions

View File

@ -1,3 +1,13 @@
2001-05-25 Michael Natterer <mitch@gimp.org>
* app/gimprc.[ch]: removed "num_processors".
* app/base/base-config.[ch]: and added it here.
* app/base/gimphistogram.c
* app/base/pixel-processor.c
* app/gui/preferences-dialog.c: changed accordingly.
2001-05-25 Michael Natterer <mitch@gimp.org>
* app/Makefile.am

View File

@ -27,11 +27,12 @@
static GimpBaseConfig static_base_config =
{
NULL,
NULL,
33554432, /* 32 MB */
FALSE,
LINEAR_INTERPOLATION
NULL, /* temp_path */
NULL, /* swap_path */
33554432, /* tile_cache_size */
FALSE, /* stingy_memory_usage */
LINEAR_INTERPOLATION, /* interpolation_type */
1, /* num_processors */
};

View File

@ -29,6 +29,7 @@ struct _GimpBaseConfig
guint tile_cache_size;
gboolean stingy_memory_use;
InterpolationType interpolation_type;
gint num_processors;
};

View File

@ -30,6 +30,7 @@
#include "base-types.h"
#include "base-config.h"
#include "gimphistogram.h"
#include "pixel-processor.h"
#include "pixel-region.h"
@ -299,10 +300,10 @@ gimp_histogram_calculate (GimpHistogram *histogram,
#ifdef ENABLE_MP
pthread_mutex_init (&histogram->mutex, NULL);
histogram->tmp_slots = g_new0 (gchar, num_processors);
histogram->tmp_values = g_new0 (gdouble **, num_processors);
histogram->tmp_slots = g_new0 (gchar, base_config->num_processors);
histogram->tmp_values = g_new0 (gdouble **, base_config->num_processors);
for (i = 0; i < num_processors; i++)
for (i = 0; i < base_config->num_processors; i++)
{
histogram->tmp_values[i] = g_new0 (double *, histogram->n_channels);
histogram->tmp_slots[i] = 0;
@ -326,7 +327,7 @@ gimp_histogram_calculate (GimpHistogram *histogram,
#ifdef ENABLE_MP
/* add up all the tmp buffers and free their memmory */
for (i = 0; i < num_processors; i++)
for (i = 0; i < base_config->num_processors; i++)
{
for (j = 0; j < histogram->n_channels; j++)
{

View File

@ -31,6 +31,7 @@
#include "base-types.h"
#include "base-config.h"
#include "pixel-processor.h"
#include "pixel-region.h"
@ -233,7 +234,7 @@ pixel_regions_do_parallel (PixelProcessor *p_s)
IF_THREAD(
gint nthreads;
nthreads = MIN (num_processors, MAX_THREADS);
nthreads = MIN (base_config->num_processors, MAX_THREADS);
/* make sure we have at least one tile per thread */
nthreads = MIN (nthreads,

View File

@ -328,10 +328,10 @@ prefs_check_settings (void)
return PREFS_CORRUPT;
}
if (num_processors < 1 || num_processors > 30)
if (base_config->num_processors < 1 || base_config->num_processors > 30)
{
g_message (_("Error: Number of processors must be between 1 and 30."));
num_processors = old_num_processors;
base_config->num_processors = old_num_processors;
return PREFS_CORRUPT;
}
@ -704,7 +704,7 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "default-threshold");
}
if (num_processors != old_num_processors)
if (base_config->num_processors != old_num_processors)
{
update = g_list_append (update, "num-processors");
}
@ -848,6 +848,8 @@ prefs_cancel_callback (GtkWidget *widget,
/* restore ordinary gimprc variables */
base_config->interpolation_type = old_interpolation_type;
base_config->num_processors = old_num_processors;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
allow_resize_windows = old_allow_resize_windows;
@ -878,7 +880,6 @@ prefs_cancel_callback (GtkWidget *widget,
help_browser = old_help_browser;
cursor_mode = old_cursor_mode;
default_threshold = old_default_threshold;
num_processors = old_num_processors;
/* restore variables which need some magic */
if (preview_size != old_preview_size)
@ -1418,6 +1419,8 @@ preferences_dialog_create (void)
/* remember all old values */
old_interpolation_type = base_config->interpolation_type;
old_num_processors = base_config->num_processors;
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
old_transparency_size = transparency_size;
@ -1454,7 +1457,6 @@ preferences_dialog_create (void)
old_help_browser = help_browser;
old_cursor_mode = cursor_mode;
old_default_threshold = default_threshold;
old_num_processors = num_processors;
prefs_strset (&old_image_title_format, image_title_format);
prefs_strset (&old_default_comment, default_comment);
@ -2242,11 +2244,11 @@ preferences_dialog_create (void)
#ifdef ENABLE_MP
spinbutton =
gimp_spin_button_new (&adjustment, num_processors,
gimp_spin_button_new (&adjustment, base_config->num_processors,
1, 30, 1.0, 2.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&num_processors);
&base_config->num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, 1, TRUE);

View File

@ -243,7 +243,6 @@ gboolean show_tool_tips = TRUE;
gdouble monitor_xres = 72.0;
gdouble monitor_yres = 72.0;
gboolean using_xserver_resolution = FALSE;
gint num_processors = 1;
gchar *image_title_format = NULL;
gboolean global_paint_options = FALSE;
gchar *module_db_load_inhibit = NULL;
@ -327,7 +326,6 @@ static ParseFunc funcs[] =
{ "unit-info", TT_XUNITINFO, NULL, NULL },
{ "monitor-xresolution", TT_DOUBLE, &monitor_xres, NULL },
{ "monitor-yresolution", TT_DOUBLE, &monitor_yres, NULL },
{ "num-processors", TT_INT, &num_processors, NULL },
{ "image-title-format", TT_STRING, &image_title_format, NULL },
{ "parasite", TT_XPARASITE, NULL, NULL },
{ "global-paint-options", TT_BOOLEAN, &global_paint_options, NULL },
@ -393,7 +391,8 @@ gimprc_init (void)
{ "swap-path", TT_PATH, NULL, NULL },
{ "tile-cache-size", TT_MEMSIZE, NULL, NULL },
{ "stingy-memory-use", TT_BOOLEAN, NULL, NULL },
{ "interpolation-type", TT_INTERP, NULL, NULL }
{ "interpolation-type", TT_INTERP, NULL, NULL },
{ "num-processors", TT_INT, NULL, NULL }
};
static gint n_base_funcs = (sizeof (base_funcs) /
sizeof (base_funcs[0]));
@ -404,6 +403,7 @@ gimprc_init (void)
base_funcs[2].val1p = &base_config->tile_cache_size;
base_funcs[3].val1p = &base_config->stingy_memory_use;
base_funcs[4].val1p = &base_config->interpolation_type;
base_funcs[4].val1p = &base_config->num_processors;
parse_func_hash = g_hash_table_new (g_str_hash, g_str_equal);

View File

@ -68,7 +68,6 @@ extern gboolean show_tool_tips;
extern gdouble monitor_xres;
extern gdouble monitor_yres;
extern gboolean using_xserver_resolution;
extern gint num_processors;
extern gchar *image_title_format;
extern gboolean global_paint_options;
extern gchar *module_db_load_inhibit;

View File

@ -328,10 +328,10 @@ prefs_check_settings (void)
return PREFS_CORRUPT;
}
if (num_processors < 1 || num_processors > 30)
if (base_config->num_processors < 1 || base_config->num_processors > 30)
{
g_message (_("Error: Number of processors must be between 1 and 30."));
num_processors = old_num_processors;
base_config->num_processors = old_num_processors;
return PREFS_CORRUPT;
}
@ -704,7 +704,7 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "default-threshold");
}
if (num_processors != old_num_processors)
if (base_config->num_processors != old_num_processors)
{
update = g_list_append (update, "num-processors");
}
@ -848,6 +848,8 @@ prefs_cancel_callback (GtkWidget *widget,
/* restore ordinary gimprc variables */
base_config->interpolation_type = old_interpolation_type;
base_config->num_processors = old_num_processors;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
allow_resize_windows = old_allow_resize_windows;
@ -878,7 +880,6 @@ prefs_cancel_callback (GtkWidget *widget,
help_browser = old_help_browser;
cursor_mode = old_cursor_mode;
default_threshold = old_default_threshold;
num_processors = old_num_processors;
/* restore variables which need some magic */
if (preview_size != old_preview_size)
@ -1418,6 +1419,8 @@ preferences_dialog_create (void)
/* remember all old values */
old_interpolation_type = base_config->interpolation_type;
old_num_processors = base_config->num_processors;
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
old_transparency_size = transparency_size;
@ -1454,7 +1457,6 @@ preferences_dialog_create (void)
old_help_browser = help_browser;
old_cursor_mode = cursor_mode;
old_default_threshold = default_threshold;
old_num_processors = num_processors;
prefs_strset (&old_image_title_format, image_title_format);
prefs_strset (&old_default_comment, default_comment);
@ -2242,11 +2244,11 @@ preferences_dialog_create (void)
#ifdef ENABLE_MP
spinbutton =
gimp_spin_button_new (&adjustment, num_processors,
gimp_spin_button_new (&adjustment, base_config->num_processors,
1, 30, 1.0, 2.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&num_processors);
&base_config->num_processors);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Number of Processors to Use:"), 1.0, 0.5,
spinbutton, 1, TRUE);