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



commit 13fd8640716e37651c89712d866b670e93ae24fb
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 | 34 +++++++++++++---------------
 2 files changed, 16 insertions(+), 19 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 97f831e9e7..4e17dc30aa 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,9 +384,7 @@ explorer_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
-
-  if (! gimp_drawable_mask_intersect (drawable_id,
+  if (! gimp_drawable_mask_intersect (drawable,
                                       &sel_x, &sel_y,
                                       &sel_width, &sel_height))
     {
@@ -466,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 ();
@@ -485,7 +483,7 @@ explorer_run (GimpProcedure        *procedure,
  *********************************************************************/
 
 static void
-explorer (gint32 drawable_id)
+explorer (GimpDrawable *drawable)
 {
   GeglBuffer *src_buffer;
   GeglBuffer *dest_buffer;
@@ -507,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");
@@ -527,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;
@@ -564,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]