Commit ab71eb9f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/paint/gimppaintoptions.c app/tools/gimpcolorbalancetool.c

2007-05-23  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintoptions.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimprectangleoptions.c
	* app/tools/gimprectangletool.c
	* app/tools/gimpthresholdtool.c
	* app/tools/tool_manager.c: allocate structs using GSlice.

svn path=/trunk/; revision=22595
parent 30bdffb1
2007-05-23 Sven Neumann <sven@gimp.org>
* app/paint/gimppaintoptions.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcolorizetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimpforegroundselecttool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimplevelstool.c
* app/tools/gimprectangleoptions.c
* app/tools/gimprectangletool.c
* app/tools/gimpthresholdtool.c
* app/tools/tool_manager.c: allocate structs using GSlice.
2007-05-23 Sven Neumann <sven@gimp.org>
* plug-ins/imagemap/imap_cmd_move_sash.c (sash_move): applied
......@@ -259,10 +259,10 @@ gimp_paint_options_init (GimpPaintOptions *options)
{
options->application_mode_save = DEFAULT_APPLICATION_MODE;
options->pressure_options = g_new0 (GimpPressureOptions, 1);
options->fade_options = g_new0 (GimpFadeOptions, 1);
options->gradient_options = g_new0 (GimpGradientOptions, 1);
options->jitter_options = g_new0 (GimpJitterOptions, 1);
options->pressure_options = g_slice_new0 (GimpPressureOptions);
options->fade_options = g_slice_new0 (GimpFadeOptions);
options->gradient_options = g_slice_new0 (GimpGradientOptions);
options->jitter_options = g_slice_new0 (GimpJitterOptions);
}
static void
......@@ -273,10 +273,10 @@ gimp_paint_options_finalize (GObject *object)
if (options->paint_info)
g_object_unref (options->paint_info);
g_free (options->pressure_options);
g_free (options->fade_options);
g_free (options->gradient_options);
g_free (options->jitter_options);
g_slice_free (GimpPressureOptions, options->pressure_options);
g_slice_free (GimpFadeOptions, options->fade_options);
g_slice_free (GimpGradientOptions, options->gradient_options);
g_slice_free (GimpJitterOptions, options->jitter_options);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -118,7 +118,7 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
static void
gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool)
{
cb_tool->color_balance = g_new0 (ColorBalance, 1);
cb_tool->color_balance = g_slice_new0 (ColorBalance);
cb_tool->transfer_mode = GIMP_MIDTONES;
color_balance_init (cb_tool->color_balance);
......@@ -129,11 +129,7 @@ gimp_color_balance_tool_finalize (GObject *object)
{
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (object);
if (cb_tool->color_balance)
{
g_free (cb_tool->color_balance);
cb_tool->color_balance = NULL;
}
g_slice_free (ColorBalance, cb_tool->color_balance);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -116,7 +116,7 @@ gimp_colorize_tool_class_init (GimpColorizeToolClass *klass)
static void
gimp_colorize_tool_init (GimpColorizeTool *col_tool)
{
col_tool->colorize = g_new0 (Colorize, 1);
col_tool->colorize = g_slice_new0 (Colorize);
colorize_init (col_tool->colorize);
}
......@@ -126,11 +126,7 @@ gimp_colorize_tool_finalize (GObject *object)
{
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (object);
if (col_tool->colorize)
{
g_free (col_tool->colorize);
col_tool->colorize = NULL;
}
g_slice_free (Colorize, col_tool->colorize);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -194,7 +194,7 @@ gimp_curves_tool_init (GimpCurvesTool *tool)
{
gint i;
tool->curves = g_new0 (Curves, 1);
tool->curves = g_slice_new0 (Curves);
tool->lut = gimp_lut_new ();
tool->channel = GIMP_HISTOGRAM_VALUE;
......@@ -212,26 +212,21 @@ gimp_curves_tool_finalize (GObject *object)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (object);
if (tool->curves)
{
g_free (tool->curves);
tool->curves = NULL;
}
if (tool->lut)
{
gimp_lut_free (tool->lut);
tool->lut = NULL;
}
g_slice_free (Curves, tool->curves);
gimp_lut_free (tool->lut);
if (tool->hist)
{
gimp_histogram_free (tool->hist);
tool->hist = NULL;
}
if (tool->cursor_layout)
{
g_object_unref (tool->cursor_layout);
tool->cursor_layout = NULL;
}
if (tool->xpos_layout)
{
g_object_unref (tool->xpos_layout);
......
......@@ -260,7 +260,7 @@ gimp_foreground_select_tool_control (GimpTool *tool,
FgSelectStroke *stroke = list->data;
g_free (stroke->points);
g_free (stroke);
g_slice_free (FgSelectStroke, stroke);
}
g_list_free (fg_select->strokes);
......@@ -798,7 +798,7 @@ gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool *fg_select,
g_return_if_fail (fg_select->stroke != NULL);
stroke = g_new (FgSelectStroke, 1);
stroke = g_slice_new (FgSelectStroke);
stroke->background = options->background;
stroke->width = ROUND ((gdouble) options->stroke_width / shell->scale_y);
......
......@@ -138,7 +138,7 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
static void
gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
{
hs_tool->hue_saturation = g_new0 (HueSaturation, 1);
hs_tool->hue_saturation = g_slice_new0 (HueSaturation);
hs_tool->hue_partition = GIMP_ALL_HUES;
hue_saturation_init (hs_tool->hue_saturation);
......@@ -149,11 +149,7 @@ gimp_hue_saturation_tool_finalize (GObject *object)
{
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (object);
if (hs_tool->hue_saturation)
{
g_free (hs_tool->hue_saturation);
hs_tool->hue_saturation = NULL;
}
g_slice_free (HueSaturation, hs_tool->hue_saturation);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -497,7 +497,6 @@ iscissors_convert (GimpIscissorsTool *iscissors,
GimpVector2 *points;
guint n_points;
GSList *list;
ICurve *icurve;
gint i;
gint index;
......@@ -508,8 +507,10 @@ iscissors_convert (GimpIscissorsTool *iscissors,
index = g_slist_length (list);
while (index)
{
ICurve *icurve;
index--;
icurve = (ICurve *) g_slist_nth_data (list, index);
icurve = g_slist_nth_data (list, index);
n_points = icurve->points->len;
points = g_new (GimpVector2, n_points);
......@@ -548,7 +549,6 @@ gimp_iscissors_tool_button_release (GimpTool *tool,
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
ICurve *curve;
/* Make sure X didn't skip the button release event -- as it's known
* to do
......@@ -585,7 +585,7 @@ gimp_iscissors_tool_button_release (GimpTool *tool,
/* Determine if we're connecting to the first point */
if (iscissors->curves)
{
curve = (ICurve *) iscissors->curves->data;
ICurve *curve = iscissors->curves->data;
if (gimp_draw_tool_on_handle (GIMP_DRAW_TOOL (tool), display,
iscissors->x, iscissors->y,
......@@ -605,7 +605,7 @@ gimp_iscissors_tool_button_release (GimpTool *tool,
if (iscissors->ix != iscissors->x ||
iscissors->iy != iscissors->y)
{
curve = g_new (ICurve, 1);
ICurve *curve = g_slice_new (ICurve);
curve->x1 = iscissors->ix;
curve->y1 = iscissors->iy;
......@@ -728,7 +728,6 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool)
GimpTool *tool = GIMP_TOOL (draw_tool);
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (draw_tool);
GimpDisplay *display;
ICurve *curve;
GSList *list;
display = tool->display;
......@@ -764,7 +763,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool)
iscissors->iy != iscissors->livewire->y1 ||
iscissors->y != iscissors->livewire->y2)))
{
curve = g_new (ICurve, 1);
ICurve *curve = g_slice_new (ICurve);
curve->x1 = iscissors->ix;
curve->y1 = iscissors->iy;
......@@ -784,7 +783,6 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool)
iscissors->livewire = curve;
calculate_curve (tool, curve);
curve = NULL;
}
/* plot the curve */
......@@ -809,7 +807,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool)
/* Go through the list of icurves, and render each one... */
for (list = iscissors->curves; list; list = g_slist_next (list))
{
curve = (ICurve *) list->data;
ICurve *curve = list->data;
if (iscissors->draw & DRAW_ACTIVE_CURVE)
{
......@@ -1152,15 +1150,14 @@ gimp_iscissors_tool_reset (GimpIscissorsTool *iscissors)
static void
iscissors_free_icurves (GSList *list)
{
ICurve * curve;
while (list)
{
curve = (ICurve *) list->data;
ICurve *curve = list->data;
if (curve->points)
g_ptr_array_free (curve->points, TRUE);
g_free (curve);
g_slice_free (ICurve, curve);
list = g_slist_next (list);
}
}
......@@ -1321,7 +1318,7 @@ clicked_on_curve (GimpIscissorsTool *iscissors,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (iscissors));
/* Create the new curve */
new_curve = g_new (ICurve, 1);
new_curve = g_slice_new (ICurve);
new_curve->x2 = curve->x2;
new_curve->y2 = curve->y2;
......
......@@ -192,7 +192,7 @@ static void
gimp_levels_tool_init (GimpLevelsTool *tool)
{
tool->lut = gimp_lut_new ();
tool->levels = g_new0 (Levels, 1);
tool->levels = g_slice_new0 (Levels);
tool->hist = NULL;
tool->channel = GIMP_HISTOGRAM_VALUE;
tool->active_picker = NULL;
......@@ -205,16 +205,9 @@ gimp_levels_tool_finalize (GObject *object)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (object);
if (tool->lut)
{
gimp_lut_free (tool->lut);
tool->lut = NULL;
}
if (tool->levels)
{
g_free (tool->levels);
tool->levels = NULL;
}
gimp_lut_free (tool->lut);
g_slice_free (Levels, tool->levels);
if (tool->hist)
{
gimp_histogram_free (tool->hist);
......
......@@ -212,7 +212,7 @@ gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *iface)
static void
gimp_rectangle_options_private_finalize (GimpRectangleOptionsPrivate *private)
{
g_free (private);
g_slice_free (GimpRectangleOptionsPrivate, private);
}
GimpRectangleOptionsPrivate *
......@@ -231,7 +231,7 @@ gimp_rectangle_options_get_private (GimpRectangleOptions *options)
if (! private)
{
private = g_new0 (GimpRectangleOptionsPrivate, 1);
private = g_slice_new0 (GimpRectangleOptionsPrivate);
g_object_set_qdata_full (G_OBJECT (options), private_key, private,
(GDestroyNotify) gimp_rectangle_options_private_finalize);
......
......@@ -251,7 +251,7 @@ gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface)
static void
gimp_rectangle_tool_private_finalize (GimpRectangleToolPrivate *private)
{
g_free (private);
g_slice_free (GimpRectangleToolPrivate, private);
}
static GimpRectangleToolPrivate *
......@@ -268,7 +268,7 @@ gimp_rectangle_tool_get_private (GimpRectangleTool *tool)
if (! private)
{
private = g_new0 (GimpRectangleToolPrivate, 1);
private = g_slice_new0 (GimpRectangleToolPrivate);
g_object_set_qdata_full (G_OBJECT (tool), private_key, private,
(GDestroyNotify)
......
......@@ -108,7 +108,7 @@ gimp_threshold_tool_class_init (GimpThresholdToolClass *klass)
static void
gimp_threshold_tool_init (GimpThresholdTool *t_tool)
{
t_tool->threshold = g_new0 (Threshold, 1);
t_tool->threshold = g_slice_new0 (Threshold);
t_tool->hist = NULL;
t_tool->threshold->low_threshold = 127;
......@@ -120,11 +120,7 @@ gimp_threshold_tool_finalize (GObject *object)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
if (t_tool->threshold)
{
g_free (t_tool->threshold);
t_tool->threshold = NULL;
}
g_slice_free (Threshold, t_tool->threshold);
if (t_tool->hist)
{
......
......@@ -75,7 +75,7 @@ tool_manager_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
tool_manager = g_new0 (GimpToolManager, 1);
tool_manager = g_slice_new0 (GimpToolManager);
tool_manager->active_tool = NULL;
tool_manager->tool_stack = NULL;
......@@ -119,7 +119,7 @@ tool_manager_exit (Gimp *gimp)
if (tool_manager->active_tool)
g_object_unref (tool_manager->active_tool);
g_free (tool_manager);
g_slice_free (GimpToolManager, tool_manager);
}
GimpTool *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment