[gimp/wip/Jehan/classy-GIMP: 15/55] plug-ins: C goat-exercise now ported to new GimpImage/GimpDrawable.



commit 26d314943c3c39e0e73b1e72c42ff4e9e89aab50
Author: Jehan <jehan girinstud io>
Date:   Tue Aug 13 18:01:03 2019 +0200

    plug-ins: C goat-exercise now ported to new GimpImage/GimpDrawable.
    
    You'll notice that with the new class when used together with the new
    GimpPlugIn API, it is not needed to allocate/destroy anymore the
    GimpImage/GimpDrawable. These can be directly the parameters.

 plug-ins/goat-exercises/Makefile.am       |  1 -
 plug-ins/goat-exercises/goat-exercise-c.c | 18 +++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/goat-exercises/Makefile.am b/plug-ins/goat-exercises/Makefile.am
index 11d3515c35..97fea37798 100644
--- a/plug-ins/goat-exercises/Makefile.am
+++ b/plug-ins/goat-exercises/Makefile.am
@@ -28,7 +28,6 @@ libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSIO
 AM_LDFLAGS = $(mwindows)
 
 AM_CPPFLAGS = \
-       -DGIMP_DEPRECATED_REPLACE_NEW_API \
        -I$(top_srcdir) \
        $(GTK_CFLAGS)   \
        $(GEGL_CFLAGS)  \
diff --git a/plug-ins/goat-exercises/goat-exercise-c.c b/plug-ins/goat-exercises/goat-exercise-c.c
index 2f7a17c221..1ec6354171 100644
--- a/plug-ins/goat-exercises/goat-exercise-c.c
+++ b/plug-ins/goat-exercises/goat-exercise-c.c
@@ -63,8 +63,8 @@ static GimpProcedure  * goat_create_procedure (GimpPlugIn           *plug_in,
 
 static GimpValueArray * goat_run              (GimpProcedure        *procedure,
                                                GimpRunMode           run_mode,
-                                               gint32                image_id,
-                                               gint32                drawable_id,
+                                               GimpImage            *image,
+                                               GimpDrawable         *drawable,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -128,8 +128,8 @@ goat_create_procedure (GimpPlugIn  *plug_in,
 static GimpValueArray *
 goat_run (GimpProcedure        *procedure,
           GimpRunMode           run_mode,
-          gint32                image_id,
-          gint32                drawable_id,
+          GimpImage            *image,
+          GimpDrawable         *drawable,
           const GimpValueArray *args,
           gpointer              run_data)
 {
@@ -240,23 +240,23 @@ goat_run (GimpProcedure        *procedure,
         }
     }
 
-  if (gimp_drawable_mask_intersect (drawable_id, &x, &y, &width, &height))
+  if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
     {
       GeglBuffer *buffer;
       GeglBuffer *shadow_buffer;
 
       gegl_init (NULL, NULL);
 
-      buffer        = gimp_drawable_get_buffer (drawable_id);
-      shadow_buffer = gimp_drawable_get_shadow_buffer (drawable_id);
+      buffer        = gimp_drawable_get_buffer (drawable);
+      shadow_buffer = gimp_drawable_get_shadow_buffer (drawable);
 
       gegl_render_op (buffer, shadow_buffer, "gegl:invert", NULL);
 
       g_object_unref (shadow_buffer); /* flushes the shadow tiles */
       g_object_unref (buffer);
 
-      gimp_drawable_merge_shadow (drawable_id, TRUE);
-      gimp_drawable_update (drawable_id, x, y, width, height);
+      gimp_drawable_merge_shadow (drawable, TRUE);
+      gimp_drawable_update (drawable, x, y, width, height);
       gimp_displays_flush ();
 
       gegl_exit ();


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