[gimp/metadata-browser] app: add shortcut functions gimp_dynamics_get_foo_value()



commit 439645a618ebf8cdca7c439e31ad433ee3f878ca
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 28 11:42:33 2012 +0200

    app: add shortcut functions gimp_dynamics_get_foo_value()
    
    and use them for simple use cases instead of dynamics_get_output() and
    output_get_foo_value().

 app/core/gimpdynamics.c    |   51 ++++++++++++++++++++++++++++++
 app/core/gimpdynamics.h    |   18 +++++++++++
 app/paint/gimpairbrush.c   |   40 ++++++++++-------------
 app/paint/gimpbrushcore.c  |   71 +++++++++++++++++-------------------------
 app/paint/gimpclone.c      |   28 +++++++---------
 app/paint/gimpconvolve.c   |   27 ++++++----------
 app/paint/gimpdodgeburn.c  |   31 ++++++------------
 app/paint/gimperaser.c     |   55 ++++++++++++++------------------
 app/paint/gimpheal.c       |   32 ++++++++-----------
 app/paint/gimppaintbrush.c |   40 +++++++++---------------
 app/paint/gimppaintcore.c  |    5 +--
 app/paint/gimpsmudge.c     |   74 ++++++++++++++++++-------------------------
 app/paint/gimpsourcecore.c |   50 +++++++++++++----------------
 13 files changed, 257 insertions(+), 265 deletions(-)
---
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index ba37b03..d575413 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -553,6 +553,57 @@ gimp_dynamics_get_output (GimpDynamics           *dynamics,
     }
 }
 
+gdouble
+gimp_dynamics_get_linear_value (GimpDynamics           *dynamics,
+                                GimpDynamicsOutputType  type,
+                                const GimpCoords       *coords,
+                                GimpPaintOptions       *options,
+                                gdouble                 fade_point)
+{
+  GimpDynamicsOutput *output;
+
+  g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
+
+  output = gimp_dynamics_get_output (dynamics, type);
+
+  return gimp_dynamics_output_get_linear_value (output, coords,
+                                                options, fade_point);
+}
+
+gdouble
+gimp_dynamics_get_angular_value (GimpDynamics           *dynamics,
+                                 GimpDynamicsOutputType  type,
+                                 const GimpCoords       *coords,
+                                 GimpPaintOptions       *options,
+                                 gdouble                 fade_point)
+{
+  GimpDynamicsOutput *output;
+
+  g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
+
+  output = gimp_dynamics_get_output (dynamics, type);
+
+  return gimp_dynamics_output_get_angular_value (output, coords,
+                                                 options, fade_point);
+}
+
+gdouble
+gimp_dynamics_get_aspect_value (GimpDynamics           *dynamics,
+                                GimpDynamicsOutputType  type,
+                                const GimpCoords       *coords,
+                                GimpPaintOptions       *options,
+                                gdouble                 fade_point)
+{
+  GimpDynamicsOutput *output;
+
+  g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
+
+  output = gimp_dynamics_get_output (dynamics, type);
+
+  return gimp_dynamics_output_get_aspect_value (output, coords,
+                                                options, fade_point);
+}
+
 
 /*  private functions  */
 
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index a6d2f6d..9daaddb 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -52,5 +52,23 @@ GimpData           * gimp_dynamics_get_standard (GimpContext            *context
 GimpDynamicsOutput * gimp_dynamics_get_output   (GimpDynamics           *dynamics,
                                                  GimpDynamicsOutputType  type);
 
+gdouble         gimp_dynamics_get_linear_value  (GimpDynamics           *dynamics,
+                                                 GimpDynamicsOutputType  type,
+                                                 const GimpCoords       *coords,
+                                                 GimpPaintOptions       *options,
+                                                 gdouble                 fade_point);
+
+gdouble         gimp_dynamics_get_angular_value (GimpDynamics           *dynamics,
+                                                 GimpDynamicsOutputType  type,
+                                                 const GimpCoords       *coords,
+                                                 GimpPaintOptions       *options,
+                                                 gdouble                 fade_point);
+
+gdouble         gimp_dynamics_get_aspect_value  (GimpDynamics           *dynamics,
+                                                 GimpDynamicsOutputType  type,
+                                                 const GimpCoords       *coords,
+                                                 GimpPaintOptions       *options,
+                                                 gdouble                 fade_point);
+
 
 #endif  /*  __GIMP_DYNAMICS_H__  */
diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c
index 0eaa6cb..d83cf12 100644
--- a/app/paint/gimpairbrush.c
+++ b/app/paint/gimpairbrush.c
@@ -28,7 +28,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpgradient.h"
 #include "core/gimpimage.h"
 
@@ -139,11 +138,10 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
 
       if ((options->rate != 0.0) && (!options->motion_only))
         {
-          GimpImage          *image = gimp_item_get_image (GIMP_ITEM (drawable));
-          GimpDynamicsOutput *rate_output;
-          gdouble             fade_point;
-          gdouble             dynamic_rate;
-          gint                timeout;
+          GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+          gdouble    fade_point;
+          gdouble    dynamic_rate;
+          gint       timeout;
 
           fade_point = gimp_paint_options_get_fade (paint_options, image,
                                                     paint_core->pixel_dist);
@@ -151,13 +149,11 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
           airbrush->drawable      = drawable;
           airbrush->paint_options = paint_options;
 
-          rate_output = gimp_dynamics_get_output (dynamics,
-                                                  GIMP_DYNAMICS_OUTPUT_RATE);
-
-          dynamic_rate = gimp_dynamics_output_get_linear_value (rate_output,
-                                                                coords,
-                                                                paint_options,
-                                                                fade_point);
+          dynamic_rate = gimp_dynamics_get_linear_value (dynamics,
+                                                         GIMP_DYNAMICS_OUTPUT_RATE,
+                                                         coords,
+                                                         paint_options,
+                                                         fade_point);
 
           timeout = 10000 / (options->rate * dynamic_rate);
 
@@ -189,23 +185,21 @@ gimp_airbrush_motion (GimpPaintCore    *paint_core,
                       const GimpCoords *coords)
 
 {
-  GimpAirbrushOptions *options = GIMP_AIRBRUSH_OPTIONS (paint_options);
-  GimpImage           *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-  GimpDynamicsOutput  *flow_output;
+  GimpAirbrushOptions *options  = GIMP_AIRBRUSH_OPTIONS (paint_options);
+  GimpDynamics        *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage           *image    = gimp_item_get_image (GIMP_ITEM (drawable));
   gdouble              opacity;
   gdouble              fade_point;
 
-  flow_output = gimp_dynamics_get_output (GIMP_BRUSH_CORE (paint_core)->dynamics,
-                                          GIMP_DYNAMICS_OUTPUT_FLOW);
-
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
   opacity = (options->flow / 100.0 *
-             gimp_dynamics_output_get_linear_value (flow_output,
-                                                    coords,
-                                                    paint_options,
-                                                    fade_point));
+             gimp_dynamics_get_linear_value (dynamics,
+                                             GIMP_DYNAMICS_OUTPUT_FLOW,
+                                             coords,
+                                             paint_options,
+                                             fade_point));
 
   _gimp_paintbrush_motion (paint_core, drawable, paint_options, coords, opacity);
 }
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index e11189b..b5b4165 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -228,7 +228,6 @@ gimp_brush_core_init (GimpBrushCore *core)
           core->subsample_brushes[i][j] = NULL;
         }
     }
-
 }
 
 static void
@@ -323,21 +322,17 @@ gimp_brush_core_pre_paint (GimpPaintCore    *paint_core,
 
           if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
             {
-              GimpDynamicsOutput *size_output;
-
-              size_output = gimp_dynamics_get_output (core->dynamics,
-                                                      GIMP_DYNAMICS_OUTPUT_SIZE);
-
               fade_point = gimp_paint_options_get_fade (paint_options, image,
                                                         paint_core->pixel_dist);
 
               scale = paint_options->brush_size /
                       MAX (gimp_temp_buf_get_width  (core->main_brush->mask),
                            gimp_temp_buf_get_height (core->main_brush->mask)) *
-                      gimp_dynamics_output_get_linear_value (size_output,
-                                                             &current_coords,
-                                                             paint_options,
-                                                             fade_point);
+                      gimp_dynamics_get_linear_value (core->dynamics,
+                                                      GIMP_DYNAMICS_OUTPUT_SIZE,
+                                                      &current_coords,
+                                                      paint_options,
+                                                      fade_point);
 
               if (scale < 0.0000001)
                 return FALSE;
@@ -735,19 +730,16 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
 
       if (core->jitter > 0.0)
         {
-          GimpDynamicsOutput *jitter_output;
-          gdouble             dyn_jitter;
-          gdouble             jitter_dist;
-          gint32              jitter_angle;
-
-          jitter_output = gimp_dynamics_get_output (core->dynamics,
-                                                    GIMP_DYNAMICS_OUTPUT_JITTER);
+          gdouble dyn_jitter;
+          gdouble jitter_dist;
+          gint32  jitter_angle;
 
           dyn_jitter = (core->jitter *
-                        gimp_dynamics_output_get_linear_value (jitter_output,
-                                                               &current_coords,
-                                                               paint_options,
-                                                               fade_point));
+                        gimp_dynamics_get_linear_value (core->dynamics,
+                                                        GIMP_DYNAMICS_OUTPUT_JITTER,
+                                                        &current_coords,
+                                                        paint_options,
+                                                        fade_point));
 
           jitter_dist  = g_rand_double_range (core->rand, 0, dyn_jitter);
           jitter_angle = g_rand_int_range (core->rand,
@@ -769,7 +761,6 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
 
       gimp_paint_core_paint (paint_core, drawable, paint_options,
                              GIMP_PAINT_STATE_MOTION, time);
-
     }
 
   current_coords.x        = last_coords.x        + delta_vec.x;
@@ -1319,7 +1310,6 @@ gimp_brush_core_solidify_mask (GimpBrushCore     *core,
   gint          dest_offset_y     = 0;
   gint          brush_mask_width  = gimp_temp_buf_get_width  (brush_mask);
   gint          brush_mask_height = gimp_temp_buf_get_height (brush_mask);
-
   gint          i, j;
 
   if ((brush_mask_width % 2) == 0)
@@ -1504,26 +1494,23 @@ gimp_brush_core_eval_transform_dynamics (GimpBrushCore     *core,
                                                     paint_core->pixel_dist);
         }
 
-      output = gimp_dynamics_get_output (core->dynamics,
-                                         GIMP_DYNAMICS_OUTPUT_SIZE);
-      core->scale *= gimp_dynamics_output_get_linear_value (output,
-                                                            coords,
-                                                            paint_options,
-                                                            fade_point);
+      core->scale *= gimp_dynamics_get_linear_value (core->dynamics,
+                                                     GIMP_DYNAMICS_OUTPUT_SIZE,
+                                                     coords,
+                                                     paint_options,
+                                                     fade_point);
 
-      output = gimp_dynamics_get_output (core->dynamics,
-                                         GIMP_DYNAMICS_OUTPUT_ANGLE);
-      core->angle += gimp_dynamics_output_get_angular_value (output,
-                                                             coords,
-                                                             paint_options,
-                                                             fade_point);
+      core->angle += gimp_dynamics_get_angular_value (core->dynamics,
+                                                      GIMP_DYNAMICS_OUTPUT_ANGLE,
+                                                      coords,
+                                                      paint_options,
+                                                      fade_point);
 
-      output = gimp_dynamics_get_output (core->dynamics,
-                                         GIMP_DYNAMICS_OUTPUT_HARDNESS);
-      core->hardness = gimp_dynamics_output_get_linear_value (output,
-                                                              coords,
-                                                              paint_options,
-                                                              fade_point);
+      core->hardness = gimp_dynamics_get_linear_value (core->dynamics,
+                                                       GIMP_DYNAMICS_OUTPUT_HARDNESS,
+                                                       coords,
+                                                       paint_options,
+                                                       fade_point);
 
       output = gimp_dynamics_get_output (core->dynamics,
                                          GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO);
@@ -1699,7 +1686,7 @@ gimp_brush_core_paint_line_pixmap_mask (GimpDrawable             *drawable,
       fish = babl_fish (pixmap_format,
                         gimp_drawable_get_format_with_alpha (drawable));
 
-      /* put the source pixmap's pixels, into one line, so we can use
+      /* put the source pixmap's pixels into one line, so we can use
        * one single call to babl_process() to convert the entire line
        */
       for (i = 0; i < width; i++)
diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c
index daa519f..17d2e08 100644
--- a/app/paint/gimpclone.c
+++ b/app/paint/gimpclone.c
@@ -31,7 +31,6 @@
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimperror.h"
 #include "core/gimpimage.h"
 #include "core/gimppattern.h"
@@ -149,14 +148,13 @@ gimp_clone_motion (GimpSourceCore   *source_core,
                    gint              paint_area_width,
                    gint              paint_area_height)
 {
-  GimpPaintCore      *paint_core     = GIMP_PAINT_CORE (source_core);
-  GimpCloneOptions   *options        = GIMP_CLONE_OPTIONS (paint_options);
-  GimpSourceOptions  *source_options = GIMP_SOURCE_OPTIONS (paint_options);
-  GimpContext        *context        = GIMP_CONTEXT (paint_options);
-  GimpImage          *image          = gimp_item_get_image (GIMP_ITEM (drawable));
-  GimpDynamicsOutput *force_output;
-  gdouble             fade_point;
-  gdouble             force;
+  GimpPaintCore     *paint_core     = GIMP_PAINT_CORE (source_core);
+  GimpCloneOptions  *options        = GIMP_CLONE_OPTIONS (paint_options);
+  GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
+  GimpContext       *context        = GIMP_CONTEXT (paint_options);
+  GimpImage         *image          = gimp_item_get_image (GIMP_ITEM (drawable));
+  gdouble            fade_point;
+  gdouble            force;
 
   switch (options->clone_type)
     {
@@ -195,16 +193,14 @@ gimp_clone_motion (GimpSourceCore   *source_core,
       break;
     }
 
-  force_output = gimp_dynamics_get_output (GIMP_BRUSH_CORE (paint_core)->dynamics,
-                                           GIMP_DYNAMICS_OUTPUT_FORCE);
-
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  force = gimp_dynamics_output_get_linear_value (force_output,
-                                                 coords,
-                                                 paint_options,
-                                                 fade_point);
+  force = gimp_dynamics_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics,
+                                          GIMP_DYNAMICS_OUTPUT_FORCE,
+                                          coords,
+                                          paint_options,
+                                          fade_point);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 coords,
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index bbdd450..1cab4c6 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -28,7 +28,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpimage.h"
 #include "core/gimppickable.h"
 #include "core/gimptempbuf.h"
@@ -129,8 +128,6 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
   GimpConvolveOptions *options    = GIMP_CONVOLVE_OPTIONS (paint_options);
   GimpContext         *context    = GIMP_CONTEXT (paint_options);
   GimpDynamics        *dynamics   = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput  *opacity_output;
-  GimpDynamicsOutput  *rate_output;
   GimpImage           *image;
   GeglBuffer          *paint_buffer;
   gint                 paint_buffer_x;
@@ -143,16 +140,14 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
-
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity = gimp_dynamics_output_get_linear_value (opacity_output,
-                                                   coords,
-                                                   paint_options,
-                                                   fade_point);
+  opacity = gimp_dynamics_get_linear_value (dynamics,
+                                            GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                            coords,
+                                            paint_options,
+                                            fade_point);
   if (opacity == 0.0)
     return;
 
@@ -163,14 +158,12 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
   if (! paint_buffer)
     return;
 
-  rate_output = gimp_dynamics_get_output (dynamics,
-                                          GIMP_DYNAMICS_OUTPUT_RATE);
-
   rate = (options->rate *
-          gimp_dynamics_output_get_linear_value (rate_output,
-                                                 coords,
-                                                 paint_options,
-                                                 fade_point));
+          gimp_dynamics_get_linear_value (dynamics,
+                                          GIMP_DYNAMICS_OUTPUT_RATE,
+                                          coords,
+                                          paint_options,
+                                          fade_point));
 
   gimp_convolve_calculate_matrix (convolve, options->type,
                                   gimp_temp_buf_get_width  (brush_core->brush->mask) / 2,
diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c
index 929dc9c..545a1be 100644
--- a/app/paint/gimpdodgeburn.c
+++ b/app/paint/gimpdodgeburn.c
@@ -30,7 +30,6 @@
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpimage.h"
 
 #include "gimpdodgeburn.h"
@@ -115,9 +114,7 @@ gimp_dodge_burn_motion (GimpPaintCore    *paint_core,
   GimpDodgeBurnOptions *options   = GIMP_DODGE_BURN_OPTIONS (paint_options);
   GimpContext          *context   = GIMP_CONTEXT (paint_options);
   GimpDynamics         *dynamics  = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput   *opacity_output;
-  GimpDynamicsOutput   *hardness_output;
-  GimpImage            *image;
+  GimpImage            *image     = gimp_item_get_image (GIMP_ITEM (drawable));
   GeglBuffer           *paint_buffer;
   gint                  paint_buffer_x;
   gint                  paint_buffer_y;
@@ -125,18 +122,14 @@ gimp_dodge_burn_motion (GimpPaintCore    *paint_core,
   gdouble               opacity;
   gdouble               hardness;
 
-  image = gimp_item_get_image (GIMP_ITEM (drawable));
-
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
-
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity = gimp_dynamics_output_get_linear_value (opacity_output,
-                                                   coords,
-                                                   paint_options,
-                                                   fade_point);
+  opacity = gimp_dynamics_get_linear_value (dynamics,
+                                            GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                            coords,
+                                            paint_options,
+                                            fade_point);
   if (opacity == 0.0)
     return;
 
@@ -159,13 +152,11 @@ gimp_dodge_burn_motion (GimpPaintCore    *paint_core,
                        options->type,
                        options->mode);
 
-  hardness_output = gimp_dynamics_get_output (dynamics,
-                                              GIMP_DYNAMICS_OUTPUT_HARDNESS);
-
-  hardness = gimp_dynamics_output_get_linear_value (hardness_output,
-                                                    coords,
-                                                    paint_options,
-                                                    fade_point);
+  hardness = gimp_dynamics_get_linear_value (dynamics,
+                                             GIMP_DYNAMICS_OUTPUT_HARDNESS,
+                                             coords,
+                                             paint_options,
+                                             fade_point);
 
   /* Replace the newly dodgedburned area (paint_area) to the image */
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 1f9a905..1ea8b03 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -26,7 +26,6 @@
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpimage.h"
 
 #include "gimperaser.h"
@@ -103,31 +102,27 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
                     GimpPaintOptions *paint_options,
                     const GimpCoords *coords)
 {
-  GimpEraserOptions  *options  = GIMP_ERASER_OPTIONS (paint_options);
-  GimpContext        *context  = GIMP_CONTEXT (paint_options);
-  GimpDynamics       *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput *opacity_output;
-  GimpDynamicsOutput *force_output;
-  gdouble             fade_point;
-  gdouble             opacity;
-  GeglBuffer         *paint_buffer;
-  gint                paint_buffer_x;
-  gint                paint_buffer_y;
-  GimpRGB             background;
-  GeglColor          *color;
-  gdouble             force;
-
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
-
-  fade_point = gimp_paint_options_get_fade (paint_options,
-                                            gimp_item_get_image (GIMP_ITEM (drawable)),
+  GimpEraserOptions *options  = GIMP_ERASER_OPTIONS (paint_options);
+  GimpContext       *context  = GIMP_CONTEXT (paint_options);
+  GimpDynamics      *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage         *image    = gimp_item_get_image (GIMP_ITEM (drawable));
+  gdouble            fade_point;
+  gdouble            opacity;
+  GeglBuffer        *paint_buffer;
+  gint               paint_buffer_x;
+  gint               paint_buffer_y;
+  GimpRGB            background;
+  GeglColor         *color;
+  gdouble            force;
+
+  fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity = gimp_dynamics_output_get_linear_value (opacity_output,
-                                                   coords,
-                                                   paint_options,
-                                                   fade_point);
+  opacity = gimp_dynamics_get_linear_value (dynamics,
+                                            GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                            coords,
+                                            paint_options,
+                                            fade_point);
   if (opacity == 0.0)
     return;
 
@@ -144,13 +139,11 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
   gegl_buffer_set_color (paint_buffer, NULL, color);
   g_object_unref (color);
 
-  force_output = gimp_dynamics_get_output (dynamics,
-                                           GIMP_DYNAMICS_OUTPUT_FORCE);
-
-  force = gimp_dynamics_output_get_linear_value (force_output,
-                                                 coords,
-                                                 paint_options,
-                                                 fade_point);
+  force = gimp_dynamics_get_linear_value (dynamics,
+                                          GIMP_DYNAMICS_OUTPUT_FORCE,
+                                          coords,
+                                          paint_options,
+                                          fade_point);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 coords,
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index 431a344..5381d76 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -31,7 +31,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimperror.h"
 #include "core/gimpimage.h"
 #include "core/gimppickable.h"
@@ -475,27 +474,24 @@ gimp_heal_motion (GimpSourceCore   *source_core,
                   gint              paint_area_width,
                   gint              paint_area_height)
 {
-  GimpPaintCore      *paint_core = GIMP_PAINT_CORE (source_core);
-  GimpContext        *context    = GIMP_CONTEXT (paint_options);
-  GimpDynamics       *dynamics   = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput *hardness_output;
-  GimpImage          *image      = gimp_item_get_image (GIMP_ITEM (drawable));
-  GeglBuffer         *src_copy;
-  GeglBuffer         *mask_buffer;
-  const GimpTempBuf  *mask_buf;
-  gdouble             fade_point;
-  gdouble             hardness;
-
-  hardness_output = gimp_dynamics_get_output (dynamics,
-                                              GIMP_DYNAMICS_OUTPUT_HARDNESS);
+  GimpPaintCore     *paint_core = GIMP_PAINT_CORE (source_core);
+  GimpContext       *context    = GIMP_CONTEXT (paint_options);
+  GimpDynamics      *dynamics   = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage         *image      = gimp_item_get_image (GIMP_ITEM (drawable));
+  GeglBuffer        *src_copy;
+  GeglBuffer        *mask_buffer;
+  const GimpTempBuf *mask_buf;
+  gdouble            fade_point;
+  gdouble            hardness;
 
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  hardness = gimp_dynamics_output_get_linear_value (hardness_output,
-                                                    coords,
-                                                    paint_options,
-                                                    fade_point);
+  hardness = gimp_dynamics_get_linear_value (dynamics,
+                                             GIMP_DYNAMICS_OUTPUT_HARDNESS,
+                                             coords,
+                                             paint_options,
+                                             fade_point);
 
   mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
                                              coords,
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index f55a92c..7aa703b 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -32,7 +32,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpgradient.h"
 #include "core/gimpimage.h"
 #include "core/gimptempbuf.h"
@@ -112,9 +111,6 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
   GimpBrushCore            *brush_core = GIMP_BRUSH_CORE (paint_core);
   GimpContext              *context    = GIMP_CONTEXT (paint_options);
   GimpDynamics             *dynamics   = brush_core->dynamics;
-  GimpDynamicsOutput       *opacity_output;
-  GimpDynamicsOutput       *color_output;
-  GimpDynamicsOutput       *force_output;
   GimpImage                *image;
   GimpRGB                   gradient_color;
   GeglBuffer               *paint_buffer;
@@ -127,16 +123,14 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
-
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity *= gimp_dynamics_output_get_linear_value (opacity_output,
-                                                    coords,
-                                                    paint_options,
-                                                    fade_point);
+  opacity *= gimp_dynamics_get_linear_value (dynamics,
+                                             GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                             coords,
+                                             paint_options,
+                                             fade_point);
   if (opacity == 0.0)
     return;
 
@@ -149,13 +143,11 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
 
   paint_appl_mode = paint_options->application_mode;
 
-  color_output = gimp_dynamics_get_output (dynamics,
-                                           GIMP_DYNAMICS_OUTPUT_COLOR);
-
-  grad_point = gimp_dynamics_output_get_linear_value (color_output,
-                                                      coords,
-                                                      paint_options,
-                                                      fade_point);
+  grad_point = gimp_dynamics_get_linear_value (dynamics,
+                                               GIMP_DYNAMICS_OUTPUT_COLOR,
+                                               coords,
+                                               paint_options,
+                                               fade_point);
 
   if (gimp_paint_options_get_gradient_color (paint_options, image,
                                              grad_point,
@@ -204,13 +196,11 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
       g_object_unref (color);
     }
 
-  force_output = gimp_dynamics_get_output (dynamics,
-                                           GIMP_DYNAMICS_OUTPUT_FORCE);
-
-  force = gimp_dynamics_output_get_linear_value (force_output,
-                                                 coords,
-                                                 paint_options,
-                                                 fade_point);
+  force = gimp_dynamics_get_linear_value (dynamics,
+                                          GIMP_DYNAMICS_OUTPUT_FORCE,
+                                          coords,
+                                          paint_options,
+                                          fade_point);
 
   /* finally, let the brush core paste the colored area on the canvas */
   gimp_brush_core_paste_canvas (brush_core, drawable,
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index fef0cd4..563d072 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -911,7 +911,8 @@ gimp_paint_core_smooth_coords (GimpPaintCore    *core,
             {
               /* We use gaussian function with velocity as a window function */
               velocity_sum += next_coords->velocity * 100;
-              rate = gaussian_weight * exp (-velocity_sum*velocity_sum / (2 * gaussian_weight2));
+              rate = gaussian_weight * exp (-velocity_sum * velocity_sum /
+                                            (2 * gaussian_weight2));
             }
 
           scale_sum += rate;
@@ -924,7 +925,5 @@ gimp_paint_core_smooth_coords (GimpPaintCore    *core,
           coords->x /= scale_sum;
           coords->y /= scale_sum;
         }
-
     }
-
 }
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index 1495c2f..eeb3d73 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -29,7 +29,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimpimage.h"
 #include "core/gimppickable.h"
 #include "core/gimptempbuf.h"
@@ -232,38 +231,31 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
                     GimpPaintOptions *paint_options,
                     const GimpCoords *coords)
 {
-  GimpSmudge         *smudge   = GIMP_SMUDGE (paint_core);
-  GimpSmudgeOptions  *options  = GIMP_SMUDGE_OPTIONS (paint_options);
-  GimpContext        *context  = GIMP_CONTEXT (paint_options);
-  GimpDynamics       *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput *opacity_output;
-  GimpDynamicsOutput *rate_output;
-  GimpDynamicsOutput *hardness_output;
-  GimpImage          *image;
-  GeglBuffer         *paint_buffer;
-  gint                paint_buffer_x;
-  gint                paint_buffer_y;
-  gint                paint_buffer_width;
-  gint                paint_buffer_height;
-  gdouble             fade_point;
-  gdouble             opacity;
-  gdouble             rate;
-  gdouble             dynamic_rate;
-  gint                x, y;
-  gdouble             hardness;
-
-  image = gimp_item_get_image (GIMP_ITEM (drawable));
-
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
+  GimpSmudge        *smudge   = GIMP_SMUDGE (paint_core);
+  GimpSmudgeOptions *options  = GIMP_SMUDGE_OPTIONS (paint_options);
+  GimpContext       *context  = GIMP_CONTEXT (paint_options);
+  GimpDynamics      *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage         *image    = gimp_item_get_image (GIMP_ITEM (drawable));
+  GeglBuffer        *paint_buffer;
+  gint               paint_buffer_x;
+  gint               paint_buffer_y;
+  gint               paint_buffer_width;
+  gint               paint_buffer_height;
+  gdouble            fade_point;
+  gdouble            opacity;
+  gdouble            rate;
+  gdouble            dynamic_rate;
+  gint               x, y;
+  gdouble            hardness;
 
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity = gimp_dynamics_output_get_linear_value (opacity_output,
-                                                   coords,
-                                                   paint_options,
-                                                   fade_point);
+  opacity = gimp_dynamics_get_linear_value (dynamics,
+                                            GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                            coords,
+                                            paint_options,
+                                            fade_point);
   if (opacity == 0.0)
     return;
 
@@ -281,13 +273,11 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
   gimp_smudge_accumulator_coords (paint_core, coords, &x, &y);
 
   /* Enable dynamic rate */
-  rate_output = gimp_dynamics_get_output (dynamics,
-                                          GIMP_DYNAMICS_OUTPUT_RATE);
-
-  dynamic_rate = gimp_dynamics_output_get_linear_value (rate_output,
-                                                        coords,
-                                                        paint_options,
-                                                        fade_point);
+  dynamic_rate = gimp_dynamics_get_linear_value (dynamics,
+                                                 GIMP_DYNAMICS_OUTPUT_RATE,
+                                                 coords,
+                                                 paint_options,
+                                                 fade_point);
 
   rate = (options->rate / 100.0) * dynamic_rate;
 
@@ -324,13 +314,11 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
                     paint_buffer,
                     GEGL_RECTANGLE (0, 0, 0, 0));
 
-  hardness_output = gimp_dynamics_get_output (dynamics,
-                                              GIMP_DYNAMICS_OUTPUT_HARDNESS);
-
-  hardness = gimp_dynamics_output_get_linear_value (hardness_output,
-                                                    coords,
-                                                    paint_options,
-                                                    fade_point);
+  hardness = gimp_dynamics_get_linear_value (dynamics,
+                                             GIMP_DYNAMICS_OUTPUT_HARDNESS,
+                                             coords,
+                                             paint_options,
+                                             fade_point);
 
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                   coords,
diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c
index d895e63..304aac5 100644
--- a/app/paint/gimpsourcecore.c
+++ b/app/paint/gimpsourcecore.c
@@ -28,7 +28,6 @@
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimperror.h"
 #include "core/gimpimage.h"
 #include "core/gimppickable.h"
@@ -346,36 +345,33 @@ gimp_source_core_motion (GimpSourceCore   *source_core,
                          const GimpCoords *coords)
 
 {
-  GimpPaintCore      *paint_core   = GIMP_PAINT_CORE (source_core);
-  GimpSourceOptions  *options      = GIMP_SOURCE_OPTIONS (paint_options);
-  GimpDynamics       *dynamics     = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpDynamicsOutput *opacity_output;
-  GimpImage          *image        = gimp_item_get_image (GIMP_ITEM (drawable));
-  GimpPickable       *src_pickable = NULL;
-  GeglBuffer         *src_buffer   = NULL;
-  GeglRectangle       src_rect;
-  gint                src_offset_x;
-  gint                src_offset_y;
-  GeglBuffer         *paint_buffer;
-  gint                paint_buffer_x;
-  gint                paint_buffer_y;
-  gint                paint_area_offset_x;
-  gint                paint_area_offset_y;
-  gint                paint_area_width;
-  gint                paint_area_height;
-  gdouble             fade_point;
-  gdouble             opacity;
-
-  opacity_output = gimp_dynamics_get_output (dynamics,
-                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
+  GimpPaintCore     *paint_core   = GIMP_PAINT_CORE (source_core);
+  GimpSourceOptions *options      = GIMP_SOURCE_OPTIONS (paint_options);
+  GimpDynamics      *dynamics     = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage         *image        = gimp_item_get_image (GIMP_ITEM (drawable));
+  GimpPickable      *src_pickable = NULL;
+  GeglBuffer        *src_buffer   = NULL;
+  GeglRectangle      src_rect;
+  gint               src_offset_x;
+  gint               src_offset_y;
+  GeglBuffer        *paint_buffer;
+  gint               paint_buffer_x;
+  gint               paint_buffer_y;
+  gint               paint_area_offset_x;
+  gint               paint_area_offset_y;
+  gint               paint_area_width;
+  gint               paint_area_height;
+  gdouble            fade_point;
+  gdouble            opacity;
 
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
 
-  opacity = gimp_dynamics_output_get_linear_value (opacity_output,
-                                                   coords,
-                                                   paint_options,
-                                                   fade_point);
+  opacity = gimp_dynamics_get_linear_value (dynamics,
+                                            GIMP_DYNAMICS_OUTPUT_OPACITY,
+                                            coords,
+                                            paint_options,
+                                            fade_point);
   if (opacity == 0.0)
     return;
 



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