[gimp] app: more code in paint and brightness-contrast tool to port.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: more code in paint and brightness-contrast tool to port.
- Date: Sat, 1 Aug 2020 16:25:51 +0000 (UTC)
commit 1fa951127e6e999aba61ee13782a65e2bf8d0906
Author: Jehan <jehan girinstud io>
Date: Sat Aug 1 18:24:15 2020 +0200
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().
app/tools/gimpbrightnesscontrasttool.c | 14 ++++++++++----
app/tools/gimppainttool-paint.c | 7 ++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c
index d3a6fda414..4f43fcfecd 100644
--- a/app/tools/gimpbrightnesscontrasttool.c
+++ b/app/tools/gimpbrightnesscontrasttool.c
@@ -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;
}
diff --git a/app/tools/gimppainttool-paint.c b/app/tools/gimppainttool-paint.c
index 88cd526b97..7c0baebe1d 100644
--- a/app/tools/gimppainttool-paint.c
+++ b/app/tools/gimppainttool-paint.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]