Commit 1fa95112 authored by Jehan's avatar Jehan

app: more code in paint and brightness-contrast tool to port.

These 2 tools only work on single drawable at once. Yet slowly getting
rid of all usage of gimp_image_get_active_drawable().
parent ac0287e2
Pipeline #200854 passed with stages
in 29 minutes and 1 second
......@@ -127,16 +127,20 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GList *drawables;
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
return FALSE;
}
if (gimp_drawable_get_component_type (drawable) == GIMP_COMPONENT_TYPE_U8)
drawables = gimp_image_get_selected_drawables (image);
/* Single drawable selection has been checked in parent initialize(). */
g_return_val_if_fail (g_list_length (drawables) == 1, FALSE);
if (gimp_drawable_get_component_type (drawables->data) == GIMP_COMPONENT_TYPE_U8)
{
gimp_prop_widget_set_factor (bc_tool->brightness_scale,
127.0, 1.0, 8.0, 0);
......@@ -151,6 +155,8 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
0.5, 0.01, 0.1, 3);
}
g_list_free (drawables);
return TRUE;
}
......
......@@ -231,6 +231,7 @@ gimp_paint_tool_paint_start (GimpPaintTool *paint_tool,
GimpDisplayShell *shell;
GimpImage *image;
GimpDrawable *drawable;
GList *drawables;
GimpCoords curr_coords;
gint off_x, off_y;
......@@ -246,10 +247,14 @@ gimp_paint_tool_paint_start (GimpPaintTool *paint_tool,
core = paint_tool->core;
shell = gimp_display_get_shell (display);
image = gimp_display_get_image (display);
drawable = gimp_image_get_active_drawable (image);
drawables = gimp_image_get_selected_drawables (image);
g_return_val_if_fail (g_list_length (drawables) == 1, FALSE);
curr_coords = *coords;
drawable = drawables->data;
g_list_free (drawables);
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
......
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