app: change GimpColorTool to not touch tool->display and tool->drawable

Instead, pass a GimpDisplay around in all virtual functions and use
that instead. Some preparation for more fancy subclasses using
GimpToolWidgets.
This commit is contained in:
Michael Natterer 2017-06-30 21:23:29 +02:00
parent b85842893d
commit bcb6b77bde
5 changed files with 156 additions and 138 deletions

View File

@ -38,7 +38,6 @@ VOID: DOUBLE
VOID: DOUBLE, DOUBLE VOID: DOUBLE, DOUBLE
VOID: DOUBLE, DOUBLE, DOUBLE, DOUBLE VOID: DOUBLE, DOUBLE, DOUBLE, DOUBLE
VOID: ENUM VOID: ENUM
VOID: ENUM, DOUBLE, DOUBLE, POINTER, POINTER, BOXED
VOID: ENUM, INT VOID: ENUM, INT
VOID: ENUM, INT, BOOLEAN VOID: ENUM, INT, BOOLEAN
VOID: ENUM, OBJECT VOID: ENUM, OBJECT
@ -58,6 +57,7 @@ VOID: POINTER
VOID: POINTER, BOXED VOID: POINTER, BOXED
VOID: POINTER, ENUM VOID: POINTER, ENUM
VOID: POINTER, FLAGS, BOOLEAN VOID: POINTER, FLAGS, BOOLEAN
VOID: POINTER, OBJECT, ENUM, POINTER, POINTER, BOXED
VOID: POINTER, UINT, FLAGS VOID: POINTER, UINT, FLAGS
VOID: STRING VOID: STRING
VOID: STRING, BOOLEAN, UINT, FLAGS VOID: STRING, BOOLEAN, UINT, FLAGS

View File

@ -30,6 +30,7 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "widgets/gimpcolorframe.h" #include "widgets/gimpcolorframe.h"
@ -66,18 +67,20 @@ static void gimp_color_picker_tool_oper_update (GimpTool *tool,
GimpDisplay *display); GimpDisplay *display);
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool, static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color); const GimpRGB *color);
static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool); static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool,
GimpDisplay *display);
static void gimp_color_picker_tool_info_response (GimpToolGui *gui, static void gimp_color_picker_tool_info_response (GimpToolGui *gui,
gint response_id, gint response_id,
GimpColorPickerTool *picker_tool); GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool, static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpDisplay *display,
gboolean sample_average, gboolean sample_average,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
@ -295,9 +298,9 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
static void static void
gimp_color_picker_tool_picked (GimpColorTool *color_tool, gimp_color_picker_tool_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color) const GimpRGB *color)
@ -308,40 +311,37 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (color_tool); options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (color_tool);
if (options->use_info_window && ! picker_tool->gui) if (options->use_info_window && ! picker_tool->gui)
gimp_color_picker_tool_info_create (picker_tool); gimp_color_picker_tool_info_create (picker_tool, display);
if (picker_tool->gui && if (picker_tool->gui &&
(options->use_info_window || (options->use_info_window ||
gimp_tool_gui_get_visible (picker_tool->gui))) gimp_tool_gui_get_visible (picker_tool->gui)))
{ {
gimp_color_picker_tool_info_update (picker_tool, gimp_color_picker_tool_info_update (picker_tool, display,
GIMP_COLOR_OPTIONS (options)->sample_average, GIMP_COLOR_OPTIONS (options)->sample_average,
sample_format, pixel, color, sample_format, pixel, color,
(gint) floor (x), (gint) floor (coords->x),
(gint) floor (y)); (gint) floor (coords->y));
} }
GIMP_COLOR_TOOL_CLASS (parent_class)->picked (color_tool, pick_state, GIMP_COLOR_TOOL_CLASS (parent_class)->picked (color_tool,
x, y, coords, display, pick_state,
sample_format, sample_format, pixel, color);
pixel, color);
} }
static void static void
gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool) gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool,
GimpDisplay *display)
{ {
GimpTool *tool = GIMP_TOOL (picker_tool); GimpTool *tool = GIMP_TOOL (picker_tool);
GimpContext *context = GIMP_CONTEXT (tool->tool_info->tool_options); GimpContext *context = GIMP_CONTEXT (tool->tool_info->tool_options);
GimpDisplayShell *shell; GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *frame; GtkWidget *frame;
GimpRGB color; GimpRGB color;
g_return_if_fail (tool->display != NULL);
g_return_if_fail (tool->drawable != NULL);
shell = gimp_display_get_shell (tool->display);
picker_tool->gui = gimp_tool_gui_new (tool->tool_info, picker_tool->gui = gimp_tool_gui_new (tool->tool_info,
NULL, NULL,
_("Color Picker Information"), _("Color Picker Information"),
@ -356,8 +356,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
gimp_tool_gui_set_auto_overlay (picker_tool->gui, TRUE); gimp_tool_gui_set_auto_overlay (picker_tool->gui, TRUE);
gimp_tool_gui_set_focus_on_map (picker_tool->gui, FALSE); gimp_tool_gui_set_focus_on_map (picker_tool->gui, FALSE);
gimp_tool_gui_set_viewable (picker_tool->gui, gimp_tool_gui_set_viewable (picker_tool->gui, GIMP_VIEWABLE (drawable));
GIMP_VIEWABLE (tool->drawable));
g_signal_connect (picker_tool->gui, "response", g_signal_connect (picker_tool->gui, "response",
G_CALLBACK (gimp_color_picker_tool_info_response), G_CALLBACK (gimp_color_picker_tool_info_response),
@ -397,7 +396,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0); gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
picker_tool->color_area = picker_tool->color_area =
gimp_color_area_new (&color, gimp_color_area_new (&color,
gimp_drawable_has_alpha (tool->drawable) ? gimp_drawable_has_alpha (drawable) ?
GIMP_COLOR_AREA_LARGE_CHECKS : GIMP_COLOR_AREA_LARGE_CHECKS :
GIMP_COLOR_AREA_FLAT, GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK); GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
@ -416,11 +415,12 @@ gimp_color_picker_tool_info_response (GimpToolGui *gui,
{ {
GimpTool *tool = GIMP_TOOL (picker_tool); GimpTool *tool = GIMP_TOOL (picker_tool);
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display); gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, NULL);
} }
static void static void
gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool, gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpDisplay *display,
gboolean sample_average, gboolean sample_average,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
@ -428,12 +428,13 @@ gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
gint x, gint x,
gint y) gint y)
{ {
GimpTool *tool = GIMP_TOOL (picker_tool); GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
gimp_tool_gui_set_shell (picker_tool->gui, gimp_tool_gui_set_shell (picker_tool->gui,
gimp_display_get_shell (tool->display)); gimp_display_get_shell (display));
gimp_tool_gui_set_viewable (picker_tool->gui, gimp_tool_gui_set_viewable (picker_tool->gui,
GIMP_VIEWABLE (tool->drawable)); GIMP_VIEWABLE (drawable));
gimp_color_area_set_color (GIMP_COLOR_AREA (picker_tool->color_area), gimp_color_area_set_color (GIMP_COLOR_AREA (picker_tool->color_area),
color); color);

View File

@ -97,19 +97,19 @@ static void gimp_color_tool_cursor_update (GimpTool *tool,
static void gimp_color_tool_draw (GimpDrawTool *draw_tool); static void gimp_color_tool_draw (GimpDrawTool *draw_tool);
static gboolean static gboolean
gimp_color_tool_real_can_pick (GimpColorTool *color_tool, gimp_color_tool_real_can_pick (GimpColorTool *color_tool,
const GimpCoords *coords, const GimpCoords *coords,
GimpDisplay *display); GimpDisplay *display);
static gboolean gimp_color_tool_real_pick (GimpColorTool *color_tool, static gboolean gimp_color_tool_real_pick (GimpColorTool *color_tool,
gint x, const GimpCoords *coords,
gint y, GimpDisplay *display,
const Babl **sample_format, const Babl **sample_format,
gpointer pixel, gpointer pixel,
GimpRGB *color); GimpRGB *color);
static void gimp_color_tool_real_picked (GimpColorTool *color_tool, static void gimp_color_tool_real_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color); const GimpRGB *color);
@ -118,12 +118,12 @@ static gboolean gimp_color_tool_can_pick (GimpColorTool *tool,
const GimpCoords *coords, const GimpCoords *coords,
GimpDisplay *display); GimpDisplay *display);
static void gimp_color_tool_pick (GimpColorTool *tool, static void gimp_color_tool_pick (GimpColorTool *tool,
GimpColorPickState pick_state, const GimpCoords *coords,
gint x, GimpDisplay *display,
gint y); GimpColorPickState pick_state);
G_DEFINE_TYPE (GimpColorTool, gimp_color_tool, GIMP_TYPE_DRAW_TOOL); G_DEFINE_TYPE (GimpColorTool, gimp_color_tool, GIMP_TYPE_DRAW_TOOL)
#define parent_class gimp_color_tool_parent_class #define parent_class gimp_color_tool_parent_class
@ -143,11 +143,11 @@ gimp_color_tool_class_init (GimpColorToolClass *klass)
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorToolClass, picked), G_STRUCT_OFFSET (GimpColorToolClass, picked),
NULL, NULL, NULL, NULL,
gimp_marshal_VOID__ENUM_DOUBLE_DOUBLE_POINTER_POINTER_BOXED, gimp_marshal_VOID__POINTER_OBJECT_ENUM_POINTER_POINTER_BOXED,
G_TYPE_NONE, 6, G_TYPE_NONE, 6,
G_TYPE_POINTER,
GIMP_TYPE_DISPLAY,
GIMP_TYPE_COLOR_PICK_STATE, GIMP_TYPE_COLOR_PICK_STATE,
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
G_TYPE_POINTER, G_TYPE_POINTER,
G_TYPE_POINTER, G_TYPE_POINTER,
GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE); GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE);
@ -202,24 +202,25 @@ gimp_color_tool_button_press (GimpTool *tool,
{ {
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool); GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
/* Chain up to activate the tool */ if (color_tool->enabled)
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
if (! color_tool->enabled)
return;
if (color_tool->sample_point)
{ {
gimp_tool_control_halt (tool->control); if (color_tool->sample_point)
{
gimp_sample_point_tool_start_edit (tool, display,
color_tool->sample_point);
}
else if (gimp_color_tool_can_pick (color_tool, coords, display))
{
gimp_color_tool_pick (color_tool, coords, display,
GIMP_COLOR_PICK_STATE_START);
gimp_sample_point_tool_start_edit (tool, display, gimp_tool_control_activate (tool->control);
color_tool->sample_point); }
} }
else if (gimp_color_tool_can_pick (color_tool, coords, display)) else
{ {
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_START, GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
coords->x, coords->y); press_type, display);
} }
} }
@ -233,18 +234,21 @@ gimp_color_tool_button_release (GimpTool *tool,
{ {
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool); GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
/* Chain up to halt the tool */ if (color_tool->enabled)
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display);
if (! color_tool->enabled)
return;
if (! color_tool->sample_point &&
gimp_color_tool_can_pick (color_tool, coords, display))
{ {
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_END, gimp_tool_control_halt (tool->control);
coords->x, coords->y);
if (! color_tool->sample_point &&
gimp_color_tool_can_pick (color_tool, coords, display))
{
gimp_color_tool_pick (color_tool, coords, display,
GIMP_COLOR_PICK_STATE_END);
}
}
else
{
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display);
} }
} }
@ -257,25 +261,30 @@ gimp_color_tool_motion (GimpTool *tool,
{ {
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool); GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
if (! color_tool->enabled) if (color_tool->enabled)
return;
if (! color_tool->sample_point)
{ {
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); if (! color_tool->sample_point)
color_tool->can_pick = gimp_color_tool_can_pick (color_tool,
coords, display);
color_tool->center_x = coords->x;
color_tool->center_y = coords->y;
if (color_tool->can_pick)
{ {
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_UPDATE, gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
coords->x, coords->y);
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool)); color_tool->can_pick = gimp_color_tool_can_pick (color_tool,
coords, display);
color_tool->center_x = coords->x;
color_tool->center_y = coords->y;
if (color_tool->can_pick)
{
gimp_color_tool_pick (color_tool, coords, display,
GIMP_COLOR_PICK_STATE_UPDATE);
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
}
else
{
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state,
display);
} }
} }
@ -331,6 +340,11 @@ gimp_color_tool_oper_update (GimpTool *tool,
gimp_draw_tool_resume (draw_tool); gimp_draw_tool_resume (draw_tool);
} }
else
{
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
proximity, display);
}
} }
static void static void
@ -378,11 +392,12 @@ gimp_color_tool_cursor_update (GimpTool *tool,
GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_TOOL_CURSOR_COLOR_PICKER,
modifier); modifier);
} }
return; /* don't chain up */
} }
else
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); {
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
display);
}
} }
static void static void
@ -420,6 +435,10 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool)
2 * radius + 1); 2 * radius + 1);
} }
} }
else
{
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
}
} }
static gboolean static gboolean
@ -429,27 +448,26 @@ gimp_color_tool_real_can_pick (GimpColorTool *color_tool,
{ {
GimpImage *image = gimp_display_get_image (display); GimpImage *image = gimp_display_get_image (display);
return return gimp_image_coords_in_active_pickable (image, coords,
gimp_image_coords_in_active_pickable (image, coords, color_tool->options->sample_merged,
color_tool->options->sample_merged, FALSE);
FALSE);
} }
static gboolean static gboolean
gimp_color_tool_real_pick (GimpColorTool *color_tool, gimp_color_tool_real_pick (GimpColorTool *color_tool,
gint x, const GimpCoords *coords,
gint y, GimpDisplay *display,
const Babl **sample_format, const Babl **sample_format,
gpointer pixel, gpointer pixel,
GimpRGB *color) GimpRGB *color)
{ {
GimpTool *tool = GIMP_TOOL (color_tool); GimpImage *image = gimp_display_get_image (display);
GimpImage *image = gimp_display_get_image (tool->display); GimpDrawable *drawable = gimp_image_get_active_drawable (image);
g_return_val_if_fail (tool->display != NULL, FALSE); g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (tool->drawable != NULL, FALSE);
return gimp_image_pick_color (image, tool->drawable, x, y, return gimp_image_pick_color (image, drawable,
coords->x, coords->y,
color_tool->options->sample_merged, color_tool->options->sample_merged,
color_tool->options->sample_average, color_tool->options->sample_average,
color_tool->options->average_radius, color_tool->options->average_radius,
@ -460,15 +478,15 @@ gimp_color_tool_real_pick (GimpColorTool *color_tool,
static void static void
gimp_color_tool_real_picked (GimpColorTool *color_tool, gimp_color_tool_real_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color) const GimpRGB *color)
{ {
GimpTool *tool = GIMP_TOOL (color_tool); GimpTool *tool = GIMP_TOOL (color_tool);
GimpDisplayShell *shell = gimp_display_get_shell (tool->display); GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImageWindow *image_window; GimpImageWindow *image_window;
GimpDialogFactory *dialog_factory; GimpDialogFactory *dialog_factory;
GimpContext *context; GimpContext *context;
@ -533,8 +551,8 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
GtkWidget *dockable; GtkWidget *dockable;
dockable = dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (tool->display->gimp)), gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (display->gimp)),
tool->display->gimp, display->gimp,
dialog_factory, dialog_factory,
screen, screen,
monitor, monitor,
@ -583,9 +601,9 @@ gimp_color_tool_can_pick (GimpColorTool *tool,
static void static void
gimp_color_tool_pick (GimpColorTool *tool, gimp_color_tool_pick (GimpColorTool *tool,
GimpColorPickState pick_state, const GimpCoords *coords,
gint x, GimpDisplay *display,
gint y) GimpColorPickState pick_state)
{ {
GimpColorToolClass *klass; GimpColorToolClass *klass;
const Babl *sample_format; const Babl *sample_format;
@ -595,11 +613,10 @@ gimp_color_tool_pick (GimpColorTool *tool,
klass = GIMP_COLOR_TOOL_GET_CLASS (tool); klass = GIMP_COLOR_TOOL_GET_CLASS (tool);
if (klass->pick && if (klass->pick &&
klass->pick (tool, x, y, &sample_format, pixel, &color)) klass->pick (tool, coords, display, &sample_format, pixel, &color))
{ {
g_signal_emit (tool, gimp_color_tool_signals[PICKED], 0, g_signal_emit (tool, gimp_color_tool_signals[PICKED], 0,
pick_state, coords, display, pick_state,
(gdouble) x, (gdouble) y,
sample_format, pixel, &color); sample_format, pixel, &color);
} }
} }

View File

@ -59,17 +59,17 @@ struct _GimpColorToolClass
const GimpCoords *coords, const GimpCoords *coords,
GimpDisplay *display); GimpDisplay *display);
gboolean (* pick) (GimpColorTool *tool, gboolean (* pick) (GimpColorTool *tool,
gint x, const GimpCoords *coords,
gint y, GimpDisplay *display,
const Babl **sample_format, const Babl **sample_format,
gpointer pixel, gpointer pixel,
GimpRGB *color); GimpRGB *color);
/* signals */ /* signals */
void (* picked) (GimpColorTool *tool, void (* picked) (GimpColorTool *tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color); const GimpRGB *color);

View File

@ -112,15 +112,15 @@ static gboolean gimp_filter_tool_can_pick_color (GimpColorTool *color_too
const GimpCoords *coords, const GimpCoords *coords,
GimpDisplay *display); GimpDisplay *display);
static gboolean gimp_filter_tool_pick_color (GimpColorTool *color_tool, static gboolean gimp_filter_tool_pick_color (GimpColorTool *color_tool,
gint x, const GimpCoords *coords,
gint y, GimpDisplay *display,
const Babl **sample_format, const Babl **sample_format,
gpointer pixel, gpointer pixel,
GimpRGB *color); GimpRGB *color);
static void gimp_filter_tool_color_picked (GimpColorTool *color_tool, static void gimp_filter_tool_color_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color); const GimpRGB *color);
@ -804,12 +804,12 @@ gimp_filter_tool_can_pick_color (GimpColorTool *color_tool,
} }
static gboolean static gboolean
gimp_filter_tool_pick_color (GimpColorTool *color_tool, gimp_filter_tool_pick_color (GimpColorTool *color_tool,
gint x, const GimpCoords *coords,
gint y, GimpDisplay *display,
const Babl **sample_format, const Babl **sample_format,
gpointer pixel, gpointer pixel,
GimpRGB *color) GimpRGB *color)
{ {
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool); GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
gint off_x, off_y; gint off_x, off_y;
@ -820,8 +820,8 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
*sample_format = gimp_drawable_get_format (filter_tool->drawable); *sample_format = gimp_drawable_get_format (filter_tool->drawable);
picked = gimp_pickable_pick_color (GIMP_PICKABLE (filter_tool->drawable), picked = gimp_pickable_pick_color (GIMP_PICKABLE (filter_tool->drawable),
x - off_x, coords->x - off_x,
y - off_y, coords->y - off_y,
color_tool->options->sample_average, color_tool->options->sample_average,
color_tool->options->average_radius, color_tool->options->average_radius,
pixel, color); pixel, color);
@ -841,20 +841,20 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
static void static void
gimp_filter_tool_color_picked (GimpColorTool *color_tool, gimp_filter_tool_color_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpColorPickState pick_state, GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format, const Babl *sample_format,
gpointer pixel, gpointer pixel,
const GimpRGB *color) const GimpRGB *color)
{ {
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool); GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
GIMP_FILTER_TOOL_GET_CLASS (filter_tool)->color_picked ( GIMP_FILTER_TOOL_GET_CLASS (filter_tool)->color_picked (filter_tool,
filter_tool, filter_tool->pick_identifier,
filter_tool->pick_identifier, coords->x,
x, y, coords->y,
sample_format, color); sample_format, color);
} }
static void static void
@ -1544,8 +1544,8 @@ gimp_filter_tool_enable_color_picking (GimpFilterTool *filter_tool,
gimp_filter_tool_disable_color_picking (filter_tool); gimp_filter_tool_disable_color_picking (filter_tool);
/* note that ownership over `identifier` is not transferred, and its lifetime /* note that ownership over 'identifier' is not transferred, and its
* should be managed by the caller. * lifetime should be managed by the caller.
*/ */
filter_tool->pick_identifier = identifier; filter_tool->pick_identifier = identifier;
filter_tool->pick_abyss = pick_abyss; filter_tool->pick_abyss = pick_abyss;