[gimp/wip/Jehan/classy-GIMP: 50/58] plug-ins: port fractal-explorer to GimpImage|Drawable.



commit 8576227f867860af4a8d77f0787c2dce87d1b573
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 17 11:06:19 2019 +0200

    plug-ins: port fractal-explorer to GimpImage|Drawable.

 plug-ins/fractal-explorer/Makefile.am        |  1 -
 plug-ins/fractal-explorer/fractal-explorer.c | 32 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/plug-ins/fractal-explorer/Makefile.am b/plug-ins/fractal-explorer/Makefile.am
index d961e7bc92..2905f1f6e5 100644
--- a/plug-ins/fractal-explorer/Makefile.am
+++ b/plug-ins/fractal-explorer/Makefile.am
@@ -34,7 +34,6 @@ fractal_explorer_SOURCES = \
        fractal-explorer.h
 
 AM_CPPFLAGS = \
-       -DGIMP_DEPRECATED_REPLACE_NEW_API \
        -I$(top_srcdir) \
        $(GTK_CFLAGS)   \
        $(GEGL_CFLAGS) \
diff --git a/plug-ins/fractal-explorer/fractal-explorer.c b/plug-ins/fractal-explorer/fractal-explorer.c
index fbf8dc864c..9e73a024ab 100644
--- a/plug-ins/fractal-explorer/fractal-explorer.c
+++ b/plug-ins/fractal-explorer/fractal-explorer.c
@@ -95,12 +95,12 @@ static GimpProcedure  * explorer_create_procedure (GimpPlugIn           *plug_in
 
 static GimpValueArray * explorer_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
-                                                   gint32                image_id,
-                                                   gint32                drawable_id,
+                                                   GimpImage            *image,
+                                                   GimpDrawable         *drawable,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
-static void       explorer                         (gint32              drawable_id);
+static void       explorer                         (GimpDrawable       *drawable);
 
 static void       delete_dialog_callback           (GtkWidget          *widget,
                                                     gboolean            value,
@@ -370,8 +370,8 @@ explorer_create_procedure (GimpPlugIn  *plug_in,
 static GimpValueArray *
 explorer_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
-              gint32                image_id,
-              gint32                drawable_id,
+              GimpImage            *image,
+              GimpDrawable         *drawable,
               const GimpValueArray *args,
               gpointer              run_data)
 {
@@ -384,7 +384,7 @@ explorer_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  if (! gimp_drawable_mask_intersect (drawable_id,
+  if (! gimp_drawable_mask_intersect (drawable,
                                       &sel_x, &sel_y,
                                       &sel_width, &sel_height))
     {
@@ -464,7 +464,7 @@ explorer_run (GimpProcedure        *procedure,
     {
       gimp_progress_init (_("Rendering fractal"));
 
-      explorer (drawable_id);
+      explorer (drawable);
 
       if (run_mode != GIMP_RUN_NONINTERACTIVE)
         gimp_displays_flush ();
@@ -483,7 +483,7 @@ explorer_run (GimpProcedure        *procedure,
  *********************************************************************/
 
 static void
-explorer (gint32 drawable_id)
+explorer (GimpDrawable *drawable)
 {
   GeglBuffer *src_buffer;
   GeglBuffer *dest_buffer;
@@ -505,16 +505,16 @@ explorer (gint32 drawable_id)
    *  need to be done for correct operation. (It simply makes it go
    *  faster, since fewer pixels need to be operated on).
    */
-  if (! gimp_drawable_mask_intersect (drawable_id, &x, &y, &w, &h))
+  if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
     return;
 
   /* Get the size of the input image. (This will/must be the same
    *  as the size of the output image.
    */
-  width  = gimp_drawable_width  (drawable_id);
-  height = gimp_drawable_height (drawable_id);
+  width  = gimp_drawable_width  (drawable);
+  height = gimp_drawable_height (drawable);
 
-  if (gimp_drawable_has_alpha (drawable_id))
+  if (gimp_drawable_has_alpha (drawable))
     format = babl_format ("R'G'B'A u8");
   else
     format = babl_format ("R'G'B' u8");
@@ -525,8 +525,8 @@ explorer (gint32 drawable_id)
   src_row  = g_new (guchar, bpp * w);
   dest_row = g_new (guchar, bpp * w);
 
-  src_buffer  = gimp_drawable_get_buffer (drawable_id);
-  dest_buffer = gimp_drawable_get_shadow_buffer (drawable_id);
+  src_buffer  = gimp_drawable_get_buffer (drawable);
+  dest_buffer = gimp_drawable_get_shadow_buffer (drawable);
 
   xbild = width;
   ybild = height;
@@ -562,8 +562,8 @@ explorer (gint32 drawable_id)
   gimp_progress_update (1.0);
 
   /*  update the processed region  */
-  gimp_drawable_merge_shadow (drawable_id, TRUE);
-  gimp_drawable_update (drawable_id, x, y, w, h);
+  gimp_drawable_merge_shadow (drawable, TRUE);
+  gimp_drawable_update (drawable, x, y, w, h);
 }
 
 /**********************************************************************


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