Commit a7f42de4 authored by Michael Natterer's avatar Michael Natterer 😴

app: turn GimpHistorgram into a GimpObject, no other changes

parent 48d312ed
......@@ -53,6 +53,5 @@ gimp_drawable_equalize (GimpDrawable *drawable,
equalize);
g_object_unref (equalize);
gimp_histogram_unref (hist);
g_object_unref (hist);
}
......@@ -58,7 +58,7 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable,
gimp_levels_config_stretch (config, histogram,
gimp_drawable_is_rgb (drawable));
gimp_histogram_unref (histogram);
g_object_unref (histogram);
levels = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp:levels",
......
This diff is collapsed.
......@@ -21,10 +21,36 @@
#define __GIMP_HISTOGRAM_H__
GimpHistogram * gimp_histogram_new (void);
#include "gimpobject.h"
#define GIMP_TYPE_HISTOGRAM (gimp_histogram_get_type ())
#define GIMP_HISTOGRAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HISTOGRAM, GimpHistogram))
#define GIMP_HISTOGRAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HISTOGRAM, GimpHistogramClass))
#define GIMP_IS_HISTOGRAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HISTOGRAM))
#define GIMP_IS_HISTOGRAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HISTOGRAM))
#define GIMP_HISTOGRAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HISTOGRAM, GimpHistogramClass))
typedef struct _GimpHistogramPrivate GimpHistogramPrivate;
typedef struct _GimpHistogramClass GimpHistogramClass;
struct _GimpHistogram
{
GimpObject parent_instance;
GimpHistogram * gimp_histogram_ref (GimpHistogram *histogram);
void gimp_histogram_unref (GimpHistogram *histogram);
GimpHistogramPrivate *priv;
};
struct _GimpHistogramClass
{
GimpObjectClass parent_class;
};
GType gimp_histogram_get_type (void) G_GNUC_CONST;
GimpHistogram * gimp_histogram_new (void);
GimpHistogram * gimp_histogram_duplicate (GimpHistogram *histogram);
......
......@@ -85,11 +85,12 @@ gimp_operation_equalize_class_init (GimpOperationEqualizeClass *klass)
point_class->process = gimp_operation_equalize_process;
g_object_class_install_property (object_class, PROP_HISTOGRAM,
g_param_spec_pointer ("histogram",
"Histogram",
"The histogram",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_param_spec_object ("histogram",
"Histogram",
"The histogram",
GIMP_TYPE_HISTOGRAM,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
static void
......@@ -104,7 +105,7 @@ gimp_operation_equalize_finalize (GObject *object)
if (self->histogram)
{
gimp_histogram_unref (self->histogram);
g_object_unref (self->histogram);
self->histogram = NULL;
}
}
......@@ -141,16 +142,14 @@ gimp_operation_equalize_set_property (GObject *object,
{
case PROP_HISTOGRAM:
if (self->histogram)
gimp_histogram_unref (self->histogram);
self->histogram = g_value_get_pointer (value);
g_object_unref (self->histogram);
self->histogram = g_value_dup_object (value);
if (self->histogram)
{
gdouble pixels;
gint max;
gint k;
gimp_histogram_ref (self->histogram);
pixels = gimp_histogram_get_count (self->histogram,
GIMP_HISTOGRAM_VALUE, 0, 255);
......
......@@ -96,10 +96,11 @@ gimp_operation_histogram_sink_class_init (GimpOperationHistogramSinkClass *klass
GEGL_PARAM_PAD_INPUT));
g_object_class_install_property (object_class, PROP_HISTOGRAM,
g_param_spec_pointer ("histogram",
"Histogram",
"The result histogram",
G_PARAM_READWRITE));
g_param_spec_object ("histogram",
"Histogram",
"The result histogram",
GIMP_TYPE_HISTOGRAM,
G_PARAM_READWRITE));
}
static void
......@@ -114,7 +115,7 @@ gimp_operation_histogram_sink_finalize (GObject *object)
if (sink->histogram)
{
gimp_histogram_unref (sink->histogram);
g_object_unref (sink->histogram);
sink->histogram = NULL;
}
......@@ -159,10 +160,8 @@ gimp_operation_histogram_sink_set_property (GObject *object,
case PROP_HISTOGRAM:
if (sink->histogram)
gimp_histogram_unref (sink->histogram);
sink->histogram = g_value_get_pointer (value);
if (sink->histogram)
gimp_histogram_ref (sink->histogram);
g_object_unref (sink->histogram);
sink->histogram = g_value_dup_object (value);
break;
default:
......
......@@ -638,7 +638,7 @@ histogram_invoker (GimpProcedure *procedure,
start_range, end_range);
percentile = count / pixels;
gimp_histogram_unref (histogram);
g_object_unref (histogram);
}
}
......
......@@ -216,7 +216,7 @@ gimp_curves_tool_initialize (GimpTool *tool,
gimp_drawable_calculate_histogram (drawable, histogram);
gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
histogram);
gimp_histogram_unref (histogram);
g_object_unref (histogram);
return TRUE;
}
......
......@@ -187,7 +187,7 @@ gimp_levels_tool_finalize (GObject *object)
if (tool->histogram)
{
gimp_histogram_unref (tool->histogram);
g_object_unref (tool->histogram);
tool->histogram = NULL;
}
......
......@@ -126,7 +126,7 @@ gimp_threshold_tool_finalize (GObject *object)
if (t_tool->histogram)
{
gimp_histogram_unref (t_tool->histogram);
g_object_unref (t_tool->histogram);
t_tool->histogram = NULL;
}
......
......@@ -261,7 +261,7 @@ gimp_histogram_editor_set_image (GimpImageEditor *image_editor,
if (editor->histogram)
{
gimp_histogram_unref (editor->histogram);
g_object_unref (editor->histogram);
editor->histogram = NULL;
gimp_histogram_view_set_histogram (view, NULL);
......@@ -269,7 +269,7 @@ gimp_histogram_editor_set_image (GimpImageEditor *image_editor,
if (editor->bg_histogram)
{
gimp_histogram_unref (editor->bg_histogram);
g_object_unref (editor->bg_histogram);
editor->bg_histogram = NULL;
gimp_histogram_view_set_background (view, NULL);
......@@ -314,7 +314,7 @@ gimp_histogram_editor_layer_changed (GimpImage *image,
{
GimpHistogramView *view = GIMP_HISTOGRAM_BOX (editor->box)->view;
gimp_histogram_unref (editor->bg_histogram);
g_object_unref (editor->bg_histogram);
editor->bg_histogram = NULL;
gimp_histogram_view_set_background (view, NULL);
......@@ -410,7 +410,7 @@ gimp_histogram_editor_frozen_update (GimpHistogramEditor *editor,
}
else if (editor->bg_histogram)
{
gimp_histogram_unref (editor->bg_histogram);
g_object_unref (editor->bg_histogram);
editor->bg_histogram = NULL;
gimp_histogram_view_set_background (view, NULL);
......
......@@ -168,13 +168,13 @@ gimp_histogram_view_finalize (GObject *object)
if (view->histogram)
{
gimp_histogram_unref (view->histogram);
g_object_unref (view->histogram);
view->histogram = NULL;
}
if (view->bg_histogram)
{
gimp_histogram_unref (view->bg_histogram);
g_object_unref (view->bg_histogram);
view->bg_histogram = NULL;
}
......@@ -630,13 +630,13 @@ gimp_histogram_view_set_histogram (GimpHistogramView *view,
if (view->histogram != histogram)
{
if (view->histogram)
gimp_histogram_unref (view->histogram);
g_object_unref (view->histogram);
view->histogram = histogram;
if (histogram)
{
gimp_histogram_ref (histogram);
g_object_ref (histogram);
if (view->channel >= gimp_histogram_n_channels (histogram))
gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
......@@ -669,13 +669,13 @@ gimp_histogram_view_set_background (GimpHistogramView *view,
if (view->bg_histogram != histogram)
{
if (view->bg_histogram)
gimp_histogram_unref (view->bg_histogram);
g_object_unref (view->bg_histogram);
view->bg_histogram = histogram;
if (histogram)
{
gimp_histogram_ref (histogram);
g_object_ref (histogram);
if (view->channel >= gimp_histogram_n_channels (histogram))
gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
......
......@@ -698,7 +698,7 @@ HELP
start_range, end_range);
percentile = count / pixels;
gimp_histogram_unref (histogram);
g_object_unref (histogram);
}
}
CODE
......
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