From 5fdee7c5e75dd3fcd9d6caeda33bd057a5ccdb18 Mon Sep 17 00:00:00 2001 From: Shubham Date: Sun, 16 Jul 2023 12:37:29 +0530 Subject: [PATCH] app: gimp_paint_core_expand_drawable will return boolean This function returns TRUE if the drawable is expanded. Otherwise, it will return FALSE. This removes the need to check width and height of the drawable to infer the same. --- app/paint/gimppaintcore.c | 12 ++++++++---- app/paint/gimppaintcore.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c index c39669b7aa..75ceba53a9 100644 --- a/app/paint/gimppaintcore.c +++ b/app/paint/gimppaintcore.c @@ -793,7 +793,8 @@ gimp_paint_core_get_show_all (GimpPaintCore *core) return core->show_all; } -void + +gboolean gimp_paint_core_expand_drawable (GimpPaintCore *core, GimpDrawable *drawable, GimpPaintOptions *options, @@ -837,13 +838,13 @@ gimp_paint_core_expand_drawable (GimpPaintCore *core, y2 < -drawable_offset_y || y1 > image_height - drawable_offset_y; if (gimp_item_get_lock_position (GIMP_ITEM (drawable))) - return; + return FALSE; if (!gimp_paint_core_get_show_all (core) && outside_image) - return; + return FALSE; if (!options->expand_use) - return; + return FALSE; if (x1 < 0) { @@ -983,7 +984,10 @@ gimp_paint_core_expand_drawable (GimpPaintCore *core, GEGL_RECTANGLE (*new_off_x, *new_off_y, 0, 0)); g_hash_table_insert (core->undo_buffers, drawable, new_buffer); g_object_unref (undo_buffer); + + return TRUE; } + return FALSE; } void diff --git a/app/paint/gimppaintcore.h b/app/paint/gimppaintcore.h index 3e82cbffe7..99da463416 100644 --- a/app/paint/gimppaintcore.h +++ b/app/paint/gimppaintcore.h @@ -155,7 +155,7 @@ void gimp_paint_core_set_show_all (GimpPaintCore *core, gboolean show_all); gboolean gimp_paint_core_get_show_all (GimpPaintCore *core); -void gimp_paint_core_expand_drawable (GimpPaintCore *paint_core, +gboolean gimp_paint_core_expand_drawable (GimpPaintCore *paint_core, GimpDrawable *drawable, GimpPaintOptions *paint_options, gint x1,