keep the central processing node around here...

2008-01-03  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpimagemaptool.[ch]: keep the central processing
	node around here...

	* app/tools/gimpbrightnesscontrasttool.[ch]
	* app/tools/gimpthresholdtool.[ch]: ...instead of here.


svn path=/trunk/; revision=24517
This commit is contained in:
Michael Natterer 2008-01-03 19:36:23 +00:00 committed by Michael Natterer
parent 8e638b0b97
commit 48358e3452
7 changed files with 28 additions and 41 deletions

View File

@ -1,3 +1,11 @@
2008-01-03 Michael Natterer <mitch@gimp.org>
* app/tools/gimpimagemaptool.[ch]: keep the central processing
node around here...
* app/tools/gimpbrightnesscontrasttool.[ch]
* app/tools/gimpthresholdtool.[ch]: ...instead of here.
2008-01-03 Michael Natterer <mitch@gimp.org>
* app/core/gimpimagemap.c: quite some cleanup (use GeglRectangle

View File

@ -140,12 +140,6 @@ gimp_brightness_contrast_tool_finalize (GObject *object)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (object);
if (bc_tool->bc_node)
{
g_object_unref (bc_tool->bc_node);
bc_tool->bc_node = NULL;
}
if (bc_tool->lut)
{
gimp_lut_free (bc_tool->lut);
@ -188,16 +182,9 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
static GeglNode *
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool *im_tool)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
if (! bc_tool->bc_node)
{
bc_tool->bc_node = g_object_new (GEGL_TYPE_NODE,
"operation", "brightness-contrast",
NULL);
}
return bc_tool->bc_node;
return g_object_new (GEGL_TYPE_NODE,
"operation", "brightness-contrast",
NULL);
}
static void
@ -205,7 +192,7 @@ gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
if (bc_tool->bc_node)
if (im_tool->operation)
{
gdouble brightness;
gdouble contrast;
@ -215,7 +202,7 @@ gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
(bc_tool->contrast + 127.0) / 127.0 :
bc_tool->contrast * 4.0 / 127.0 + 1);
gegl_node_set (bc_tool->bc_node,
gegl_node_set (im_tool->operation,
"brightness", brightness,
"contrast", contrast,
NULL);

View File

@ -44,7 +44,6 @@ struct _GimpBrightnessContrastTool
gdouble brightness;
gdouble contrast;
GimpLut *lut;
GeglNode *bc_node;
/* dialog */
GtkAdjustment *brightness_data;

View File

@ -169,6 +169,12 @@ gimp_image_map_tool_finalize (GObject *object)
{
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (object);
if (image_map_tool->operation)
{
g_object_unref (image_map_tool->operation);
image_map_tool->operation = NULL;
}
if (image_map_tool->shell)
{
gtk_widget_destroy (image_map_tool->shell);
@ -446,12 +452,12 @@ gimp_image_map_tool_create_map (GimpImageMapTool *tool)
g_object_unref (tool->image_map);
}
if (tool->use_gegl)
operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
if (tool->use_gegl && ! tool->operation)
tool->operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
tool->image_map = gimp_image_map_new (tool->drawable,
GIMP_TOOL (tool)->tool_info->blurb,
operation);
tool->operation);
g_signal_connect (tool->image_map, "flush",
G_CALLBACK (gimp_image_map_tool_flush),

View File

@ -44,6 +44,7 @@ struct _GimpImageMapTool
GimpColorTool parent_instance;
GimpDrawable *drawable;
GeglNode *operation;
GimpImageMap *image_map;
/* dialog */

View File

@ -123,12 +123,6 @@ gimp_threshold_tool_finalize (GObject *object)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
if (t_tool->t_node)
{
g_object_unref (t_tool->t_node);
t_tool->t_node = NULL;
}
g_slice_free (Threshold, t_tool->threshold);
if (t_tool->hist)
@ -189,16 +183,9 @@ gimp_threshold_tool_initialize (GimpTool *tool,
static GeglNode *
gimp_threshold_tool_get_operation (GimpImageMapTool *im_tool)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (im_tool);
if (! t_tool->t_node)
{
t_tool->t_node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-threshold",
NULL);
}
return t_tool->t_node;
return g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-threshold",
NULL);
}
static void
@ -206,9 +193,9 @@ gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
if (t_tool->t_node)
if (image_map_tool->operation)
{
gegl_node_set (t_tool->t_node,
gegl_node_set (image_map_tool->operation,
"low", t_tool->threshold->low_threshold / 255.0,
"high", t_tool->threshold->high_threshold / 255.0,
NULL);

View File

@ -39,7 +39,6 @@ struct _GimpThresholdTool
GimpImageMapTool parent_instance;
Threshold *threshold;
GeglNode *t_node;
/* dialog */
GimpHistogram *hist;