[gimp] Issue #6792: broken annotation for GimpRunBrushCallback.



commit 1918736b9913476985dbc03639ab56b8afeb3cb9
Author: Jehan <jehan girinstud io>
Date:   Sun Feb 13 18:58:26 2022 +0100

    Issue #6792: broken annotation for GimpRunBrushCallback.
    
    As Massimo notes, the issue is not about the callback being broken in
    bindings, but simply that bindings fail to handle random data without an
    associated size. So let's just add the size. I confirmed testing API in
    the Python binding that it now works fine.

 libgimp/gimpbrushselect.c       | 3 +++
 libgimp/gimpbrushselect.h       | 4 +++-
 libgimp/gimpbrushselectbutton.c | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libgimp/gimpbrushselect.c b/libgimp/gimpbrushselect.c
index 697d510de1..101f5a1b18 100644
--- a/libgimp/gimpbrushselect.c
+++ b/libgimp/gimpbrushselect.c
@@ -33,6 +33,7 @@ typedef struct
   gint                  paint_mode;
   gint                  width;
   gint                  height;
+  gint                  brush_mask_size;
   guchar               *brush_mask_data;
   GimpRunBrushCallback  callback;
   gboolean              closing;
@@ -224,6 +225,7 @@ gimp_temp_brush_run (GimpProcedure        *procedure,
   data->paint_mode      = GIMP_VALUES_GET_ENUM        (args, 3);
   data->width           = GIMP_VALUES_GET_INT         (args, 4);
   data->height          = GIMP_VALUES_GET_INT         (args, 5);
+  data->brush_mask_size = GIMP_VALUES_GET_INT         (args, 6);
   data->brush_mask_data = GIMP_VALUES_DUP_UINT8_ARRAY (args, 7);
   data->closing         = GIMP_VALUES_GET_BOOLEAN     (args, 8);
 
@@ -245,6 +247,7 @@ gimp_temp_brush_idle (GimpBrushData *data)
                     data->paint_mode,
                     data->width,
                     data->height,
+                    data->brush_mask_size,
                     data->brush_mask_data,
                     data->closing,
                     data->data);
diff --git a/libgimp/gimpbrushselect.h b/libgimp/gimpbrushselect.h
index c62c3c7b1d..6ed7916653 100644
--- a/libgimp/gimpbrushselect.h
+++ b/libgimp/gimpbrushselect.h
@@ -35,7 +35,8 @@ G_BEGIN_DECLS
  * @paint_mode: Paint mode
  * @width: width
  * @height: height
- * @mask_data: (array): Mask data
+ * @mask_size: Mask size.
+ * @mask_data: (array length=mask_size): Mask data
  * @dialog_closing: Dialog closing?
  * @user_data: (closure): user data
  */
@@ -45,6 +46,7 @@ typedef void (* GimpRunBrushCallback)   (const gchar          *brush_name,
                                          GimpLayerMode         paint_mode,
                                          gint                  width,
                                          gint                  height,
+                                         gint                  mask_size,
                                          const guchar         *mask_data,
                                          gboolean              dialog_closing,
                                          gpointer              user_data);
diff --git a/libgimp/gimpbrushselectbutton.c b/libgimp/gimpbrushselectbutton.c
index 359436c11f..4e57f68798 100644
--- a/libgimp/gimpbrushselectbutton.c
+++ b/libgimp/gimpbrushselectbutton.c
@@ -104,6 +104,7 @@ static void   gimp_brush_select_button_callback (const gchar          *brush_nam
                                                  GimpLayerMode         paint_mode,
                                                  gint                  width,
                                                  gint                  height,
+                                                 gint                  mask_size,
                                                  const guchar         *mask_data,
                                                  gboolean              dialog_closing,
                                                  gpointer              user_data);
@@ -449,7 +450,8 @@ gimp_brush_select_button_set_brush (GimpBrushSelectButton *button,
 
           gimp_brush_select_button_callback (name,
                                              opacity, spacing, paint_mode,
-                                             width, height, mask_data,
+                                             width, height, width * height,
+                                             mask_data,
                                              FALSE, button);
 
           g_free (mask_data);
@@ -564,6 +566,7 @@ gimp_brush_select_button_callback (const gchar   *name,
                                    GimpLayerMode  paint_mode,
                                    gint           width,
                                    gint           height,
+                                   gint           mask_size,
                                    const guchar  *mask_data,
                                    gboolean       dialog_closing,
                                    gpointer       data)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]