summaryrefslogtreecommitdiff
path: root/graphics/gimp-refocus-plugin/files/patch-src__refocus.c
blob: b7810df041cad7d8a29d5c499ad8cee001ad61fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- src/refocus.c	2014-03-27 20:00:17.000000000 -0300
+++ src/refocus.c	2014-03-27 20:00:38.000000000 -0300
@@ -45,9 +45,9 @@
 
 /* Declare local functions. */
 static void query (void);
-static void run (char *name,
+static void run (const gchar *name,
                  gint nparams,
-                 GimpParam * param,
+                 const GimpParam * param,
                  gint * nreturn_vals, GimpParam ** return_vals);
 static gint dialog ();
 static void doit (void);
@@ -111,7 +111,6 @@
     {GIMP_PDB_FLOAT, "noise", "Noise to Signal ratio"},
   };
   static GimpParamDef *return_vals = NULL;
-  static gint nargs = (gint) (sizeof (args) / sizeof (args[0]));
   static gint nreturn_vals = 0;
 
   gimp_install_procedure ("plug_in_refocus",
@@ -123,15 +122,15 @@
                           "<Image>/Filters/Enhance/Refocus ...",
                           "RGB*, GRAY*",
                           GIMP_PLUGIN,
-                          nargs, nreturn_vals, args, return_vals);
+                          G_N_ELEMENTS(args), nreturn_vals, args, return_vals);
 }
 
 static void
-run (char *name, gint n_params, GimpParam * param,
+run (const gchar *name, gint n_params, const GimpParam * param,
      gint * nreturn_vals, GimpParam ** return_vals)
 {
   static GimpParam values[1];
-  GimpRunModeType run_mode;
+  GimpRunMode run_mode;
   GimpPDBStatusType status = GIMP_PDB_SUCCESS;
 
   (void) name;                  /* Shut up warnings about unused parameters. */
@@ -186,8 +185,8 @@
     {
 
       /*  Make sure that the drawable is gray or RGB color  */
-      if (gimp_drawable_is_rgb (drawable->id) ||
-          gimp_drawable_is_gray (drawable->id))
+      if (gimp_drawable_is_rgb (drawable->drawable_id) ||
+          gimp_drawable_is_gray (drawable->drawable_id))
         {
           doit ();
 
@@ -336,7 +335,7 @@
   (void) data;
   set_busy_cursor (widget, TRUE);
   update_matrix ();
-  gimp_preview_update (GIMP_PREVIEW (my_widgets.preview));
+  gimp_preview_update (MY_GIMP_PREVIEW (my_widgets.preview));
   set_busy_cursor (widget, FALSE);
 }
 
@@ -369,11 +368,11 @@
 {
   gint event_id = GPOINTER_TO_INT (data);
   return (gimp_preview_progress_set_fraction
-          (GIMP_PREVIEW (my_widgets.preview), event_id, arg));
+          (MY_GIMP_PREVIEW (my_widgets.preview), event_id, arg));
 }
 
 static void
-preview_callback (GtkWidget * widget, GimpPreviewEvent * event, gpointer data)
+preview_callback (GtkWidget * widget, myGimpPreviewEvent * event, gpointer data)
 {
   TileSource source;
   TileSink sink;
@@ -393,7 +392,7 @@
                                       im_width, im_height);
       tile_sink_init_for_preview (&sink, drawable, image_x, image_y,
                                   im_width, im_height);
-      gimp_preview_progress_set_fraction (GIMP_PREVIEW (my_widgets.preview),
+      gimp_preview_progress_set_fraction (MY_GIMP_PREVIEW (my_widgets.preview),
                                           event->event_id, 0);
       bd_closure_init (&update_progress_closure,
                        preview_progress_update_fun,
@@ -409,9 +408,9 @@
         {
           tile_sink_get_row (&sink, buf, image_x, image_y + row, im_width);
           event_is_current =
-            gimp_preview_draw_unscaled_row (GIMP_PREVIEW (my_widgets.preview),
+            gimp_preview_draw_unscaled_row (MY_GIMP_PREVIEW (my_widgets.preview),
                                             event->event_id,
-                                            gimp_drawable_type (drawable->id),
+                                            gimp_drawable_type (drawable->drawable_id),
                                             row, buf);
         };
       g_free (buf);
@@ -583,7 +582,7 @@
 
   gtk_widget_show (dlg);
   redraw_all ();
-  gimp_preview_update (GIMP_PREVIEW (preview));
+  gimp_preview_update (MY_GIMP_PREVIEW (preview));
   gtk_main ();
   gdk_flush ();
   return run_flag;
@@ -608,7 +607,7 @@
   gimp_progress_init ("Computing matrix");
   update_matrix ();
   gimp_progress_init ("Applying convolution");
-  gimp_drawable_mask_bounds (drawable->id, &sx1, &sy1, &sx2, &sy2);
+  gimp_drawable_mask_bounds (drawable->drawable_id, &sx1, &sy1, &sx2, &sy2);
   width = sx2 - sx1;
   height = sy2 - sy1;
   tile_source_init_from_drawable (&source, drawable, sx1, sy1, width, height);
@@ -618,7 +617,7 @@
                   matrix, 2 * my_config.mat_width + 1,
                   &update_progress_closure);
   gimp_drawable_flush (drawable);
-  gimp_drawable_merge_shadow (drawable->id, TRUE);
-  gimp_drawable_update (drawable->id, sx1, sy1, width, height);
+  gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
+  gimp_drawable_update (drawable->drawable_id, sx1, sy1, width, height);
   g_free (matrix);
 }