[gimp] app: use gimp_symmetry_get_transform() in paint code
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use gimp_symmetry_get_transform() in paint code
- Date: Sun, 26 May 2019 18:50:07 +0000 (UTC)
commit b63af476bd898c5c702653af8a1751466f6292c0
Author: Ell <ell_se yahoo com>
Date: Sun May 26 14:21:09 2019 -0400
app: use gimp_symmetry_get_transform() in paint code
Use gimp_symmetry_get_transform() instead of
gimp_symmetry_get_operation() throughout the paint code, where
possible. This allows us to combine the symmetry transform with
the ordinary brush transform, simplifying the code, improving
performance, and avoiding multiple resamplings. This also fixes
the paint-buffer size when using mandala symmetry with non-round
brushes, avoiding artifacts.
app/core/gimpbrush-boundary.c | 2 +-
app/core/gimpbrush.c | 75 ++++-----------------------------
app/core/gimpbrush.h | 2 -
app/core/gimpbrushcache.c | 25 +++++------
app/core/gimpbrushcache.h | 2 -
app/paint/gimpbrushcore.c | 98 ++++++++++++++++++++++++++++++++-----------
app/paint/gimpbrushcore.h | 20 +++++----
app/paint/gimpclone.c | 3 +-
app/paint/gimpconvolve.c | 9 ++--
app/paint/gimpdodgeburn.c | 21 ++++------
app/paint/gimperaser.c | 20 ++++-----
app/paint/gimpheal.c | 4 +-
app/paint/gimppaintbrush.c | 13 +++---
app/paint/gimpsmudge.c | 22 +++++-----
app/paint/gimpsourcecore.c | 5 ++-
15 files changed, 148 insertions(+), 173 deletions(-)
---
diff --git a/app/core/gimpbrush-boundary.c b/app/core/gimpbrush-boundary.c
index cdc40837b6..9e5cbaaeda 100644
--- a/app/core/gimpbrush-boundary.c
+++ b/app/core/gimpbrush-boundary.c
@@ -40,7 +40,7 @@ gimp_brush_transform_boundary_exact (GimpBrush *brush,
{
const GimpTempBuf *mask;
- mask = gimp_brush_transform_mask (brush, NULL,
+ mask = gimp_brush_transform_mask (brush,
scale, aspect_ratio,
angle, reflect, hardness);
diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c
index 9bbf5e7954..ddb1e2be59 100644
--- a/app/core/gimpbrush.c
+++ b/app/core/gimpbrush.c
@@ -298,14 +298,14 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
{
GimpBrushGenerated *gen_brush = GIMP_BRUSH_GENERATED (brush);
- mask_buf = gimp_brush_transform_mask (brush, NULL, scale,
+ mask_buf = gimp_brush_transform_mask (brush, scale,
(gimp_brush_generated_get_aspect_ratio (gen_brush) -
1.0) * 20.0 / 19.0,
gimp_brush_generated_get_angle (gen_brush) / 360.0,
FALSE,
gimp_brush_generated_get_hardness (gen_brush));
}
else
- mask_buf = gimp_brush_transform_mask (brush, NULL, scale,
+ mask_buf = gimp_brush_transform_mask (brush, scale,
0.0, 0.0, FALSE, 1.0);
if (! mask_buf)
@@ -319,7 +319,7 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
}
if (pixmap_buf)
- pixmap_buf = gimp_brush_transform_pixmap (brush, NULL, scale,
+ pixmap_buf = gimp_brush_transform_pixmap (brush, scale,
0.0, 0.0, FALSE, 1.0);
mask_width = gimp_temp_buf_get_width (mask_buf);
@@ -633,7 +633,6 @@ gimp_brush_transform_size (GimpBrush *brush,
const GimpTempBuf *
gimp_brush_transform_mask (GimpBrush *brush,
- GeglNode *op,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
@@ -653,7 +652,7 @@ gimp_brush_transform_mask (GimpBrush *brush,
&width, &height);
mask = gimp_brush_cache_get (brush->priv->mask_cache,
- op, width, height,
+ width, height,
scale, aspect_ratio, angle, reflect, hardness);
if (! mask)
@@ -690,37 +689,9 @@ gimp_brush_transform_mask (GimpBrush *brush,
reflect,
effective_hardness);
- if (op)
- {
- GeglNode *graph, *source, *target;
- GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) mask);
-
- graph = gegl_node_new ();
- source = gegl_node_new_child (graph,
- "operation", "gegl:buffer-source",
- "buffer", buffer,
- NULL);
- gegl_node_add_child (graph, op);
- target = gegl_node_new_child (graph,
- "operation", "gegl:write-buffer",
- "buffer", buffer,
- NULL);
-
- gegl_node_link_many (source, op, target, NULL);
- gegl_node_blit (target, 1.0,
- GEGL_RECTANGLE (0, 0,
- gegl_buffer_get_width (buffer),
- gegl_buffer_get_height (buffer)),
- NULL, NULL, 0, GEGL_BLIT_DEFAULT);
-
-
- g_object_unref (graph);
- g_object_unref (buffer);
- }
-
gimp_brush_cache_add (brush->priv->mask_cache,
(gpointer) mask,
- op, width, height,
+ width, height,
scale, aspect_ratio, angle, reflect, effective_hardness);
}
@@ -729,7 +700,6 @@ gimp_brush_transform_mask (GimpBrush *brush,
const GimpTempBuf *
gimp_brush_transform_pixmap (GimpBrush *brush,
- GeglNode *op,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
@@ -750,7 +720,7 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
&width, &height);
pixmap = gimp_brush_cache_get (brush->priv->pixmap_cache,
- op, width, height,
+ width, height,
scale, aspect_ratio, angle, reflect, hardness);
if (! pixmap)
@@ -782,36 +752,9 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
reflect,
effective_hardness);
- if (op)
- {
- GeglNode *graph, *source, *target;
- GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) pixmap);
-
- graph = gegl_node_new ();
- source = gegl_node_new_child (graph,
- "operation", "gegl:buffer-source",
- "buffer", buffer,
- NULL);
- gegl_node_add_child (graph, op);
- target = gegl_node_new_child (graph,
- "operation", "gegl:write-buffer",
- "buffer", buffer,
- NULL);
-
- gegl_node_link_many (source, op, target, NULL);
- gegl_node_blit (target, 1.0,
- GEGL_RECTANGLE (0, 0,
- gegl_buffer_get_width (buffer),
- gegl_buffer_get_height (buffer)),
- NULL, NULL, 0, GEGL_BLIT_DEFAULT);
-
- g_object_unref (graph);
- g_object_unref (buffer);
- }
-
gimp_brush_cache_add (brush->priv->pixmap_cache,
(gpointer) pixmap,
- op, width, height,
+ width, height,
scale, aspect_ratio, angle, reflect, effective_hardness);
}
@@ -840,7 +783,7 @@ gimp_brush_transform_boundary (GimpBrush *brush,
width, height);
boundary = gimp_brush_cache_get (brush->priv->boundary_cache,
- NULL, *width, *height,
+ *width, *height,
scale, aspect_ratio, angle, reflect, hardness);
if (! boundary)
@@ -863,7 +806,7 @@ gimp_brush_transform_boundary (GimpBrush *brush,
if (boundary)
gimp_brush_cache_add (brush->priv->boundary_cache,
(gpointer) boundary,
- NULL, *width, *height,
+ *width, *height,
scale, aspect_ratio, angle, reflect, hardness);
}
diff --git a/app/core/gimpbrush.h b/app/core/gimpbrush.h
index 017cb953e2..b5735f0dd2 100644
--- a/app/core/gimpbrush.h
+++ b/app/core/gimpbrush.h
@@ -113,14 +113,12 @@ void gimp_brush_transform_size (GimpBrush *brush,
gint *width,
gint *height);
const GimpTempBuf * gimp_brush_transform_mask (GimpBrush *brush,
- GeglNode *op,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness);
const GimpTempBuf * gimp_brush_transform_pixmap (GimpBrush *brush,
- GeglNode *op,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
diff --git a/app/core/gimpbrushcache.c b/app/core/gimpbrushcache.c
index 579ff825d9..07ad0082b4 100644
--- a/app/core/gimpbrushcache.c
+++ b/app/core/gimpbrushcache.c
@@ -44,16 +44,15 @@ typedef struct _GimpBrushCacheUnit GimpBrushCacheUnit;
struct _GimpBrushCacheUnit
{
- gpointer data;
-
- gint width;
- gint height;
- gdouble scale;
- gdouble aspect_ratio;
- gdouble angle;
- gboolean reflect;
- gdouble hardness;
- GeglNode *op;
+ gpointer data;
+
+ gint width;
+ gint height;
+ gdouble scale;
+ gdouble aspect_ratio;
+ gdouble angle;
+ gboolean reflect;
+ gdouble hardness;
};
@@ -201,7 +200,6 @@ gimp_brush_cache_clear (GimpBrushCache *cache)
gconstpointer
gimp_brush_cache_get (GimpBrushCache *cache,
- GeglNode *op,
gint width,
gint height,
gdouble scale,
@@ -225,8 +223,7 @@ gimp_brush_cache_get (GimpBrushCache *cache,
unit->aspect_ratio == aspect_ratio &&
unit->angle == angle &&
unit->reflect == reflect &&
- unit->hardness == hardness &&
- unit->op == op)
+ unit->hardness == hardness)
{
if (gimp_log_flags & GIMP_LOG_BRUSH_CACHE)
g_printerr ("%c", cache->debug_hit);
@@ -251,7 +248,6 @@ gimp_brush_cache_get (GimpBrushCache *cache,
void
gimp_brush_cache_add (GimpBrushCache *cache,
gpointer data,
- GeglNode *op,
gint width,
gint height,
gdouble scale,
@@ -298,7 +294,6 @@ gimp_brush_cache_add (GimpBrushCache *cache,
unit->angle = angle;
unit->reflect = reflect;
unit->hardness = hardness;
- unit->op = op;
cache->cached_units = g_list_prepend (cache->cached_units, unit);
}
diff --git a/app/core/gimpbrushcache.h b/app/core/gimpbrushcache.h
index c1b888a115..77221170b4 100644
--- a/app/core/gimpbrushcache.h
+++ b/app/core/gimpbrushcache.h
@@ -62,7 +62,6 @@ GimpBrushCache * gimp_brush_cache_new (GDestroyNotify data_destory,
void gimp_brush_cache_clear (GimpBrushCache *cache);
gconstpointer gimp_brush_cache_get (GimpBrushCache *cache,
- GeglNode *op,
gint width,
gint height,
gdouble scale,
@@ -72,7 +71,6 @@ gconstpointer gimp_brush_cache_get (GimpBrushCache *cache,
gdouble hardness);
void gimp_brush_cache_add (GimpBrushCache *cache,
gpointer data,
- GeglNode *op,
gint width,
gint height,
gdouble scale,
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index d1fed9a5d5..da4f26b9bd 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -39,6 +39,7 @@
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "core/gimpmarshal.h"
+#include "core/gimpsymmetry.h"
#include "core/gimptempbuf.h"
#include "gimpbrushcore.h"
@@ -99,10 +100,12 @@ static void gimp_brush_core_real_set_brush (GimpBrushCore *core,
static void gimp_brush_core_real_set_dynamics (GimpBrushCore *core,
GimpDynamics *dynamics);
+static gdouble gimp_brush_core_get_angle (GimpBrushCore *core);
+static gboolean gimp_brush_core_get_reflect (GimpBrushCore *core);
+
static const GimpTempBuf *
gimp_brush_core_transform_mask (GimpBrushCore *core,
- GimpBrush *brush,
- GeglNode *op);
+ GimpBrush *brush);
static void gimp_brush_core_invalidate_cache (GimpBrush *brush,
GimpBrushCore *core);
@@ -167,10 +170,14 @@ gimp_brush_core_init (GimpBrushCore *core)
core->dynamics = NULL;
core->spacing = 1.0;
core->scale = 1.0;
- core->angle = 1.0;
+ core->angle = 0.0;
+ core->reflect = FALSE;
core->hardness = 1.0;
core->aspect_ratio = 0.0;
+ core->symmetry_angle = 0.0;
+ core->symmetry_reflect = FALSE;
+
core->pressure_brush = NULL;
core->last_solid_brush_mask = NULL;
@@ -380,6 +387,8 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
drawable,
paint_options,
coords);
+
+ gimp_brush_core_eval_transform_symmetry (core, NULL, 0);
}
core->spacing = paint_options->brush_spacing;
@@ -793,7 +802,8 @@ gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
gimp_brush_transform_size (core->brush,
core->scale, core->aspect_ratio,
- core->angle, core->reflect,
+ gimp_brush_core_get_angle (core),
+ gimp_brush_core_get_reflect (core),
&brush_width, &brush_height);
if (paint_width)
@@ -921,12 +931,11 @@ gimp_brush_core_paste_canvas (GimpBrushCore *core,
GimpLayerMode paint_mode,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_force,
- GimpPaintApplicationMode mode,
- GeglNode *op)
+ GimpPaintApplicationMode mode)
{
const GimpTempBuf *brush_mask;
- brush_mask = gimp_brush_core_get_brush_mask (core, coords, op,
+ brush_mask = gimp_brush_core_get_brush_mask (core, coords,
brush_hardness,
dynamic_force);
@@ -966,12 +975,11 @@ gimp_brush_core_replace_canvas (GimpBrushCore *core,
gdouble image_opacity,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_force,
- GimpPaintApplicationMode mode,
- GeglNode *op)
+ GimpPaintApplicationMode mode)
{
const GimpTempBuf *brush_mask;
- brush_mask = gimp_brush_core_get_brush_mask (core, coords, op,
+ brush_mask = gimp_brush_core_get_brush_mask (core, coords,
brush_hardness,
dynamic_force);
@@ -1018,10 +1026,33 @@ gimp_brush_core_invalidate_cache (GimpBrush *brush,
* LOCAL FUNCTION DEFINITIONS *
************************************************************/
+static gdouble
+gimp_brush_core_get_angle (GimpBrushCore *core)
+{
+ gdouble angle = core->angle;
+
+ if (core->reflect)
+ angle -= core->symmetry_angle;
+ else
+ angle += core->symmetry_angle;
+
+ angle = fmod (angle, 1.0);
+
+ if (angle < 0.0)
+ angle += 1.0;
+
+ return angle;
+}
+
+static gboolean
+gimp_brush_core_get_reflect (GimpBrushCore *core)
+{
+ return core->reflect ^ core->symmetry_reflect;
+}
+
static const GimpTempBuf *
gimp_brush_core_transform_mask (GimpBrushCore *core,
- GimpBrush *brush,
- GeglNode *op)
+ GimpBrush *brush)
{
const GimpTempBuf *mask;
@@ -1029,11 +1060,10 @@ gimp_brush_core_transform_mask (GimpBrushCore *core,
return NULL;
mask = gimp_brush_transform_mask (brush,
- op,
core->scale,
core->aspect_ratio,
- core->angle,
- core->reflect,
+ gimp_brush_core_get_angle (core),
+ gimp_brush_core_get_reflect (core),
core->hardness);
if (mask == core->transform_brush)
@@ -1049,7 +1079,6 @@ gimp_brush_core_transform_mask (GimpBrushCore *core,
const GimpTempBuf *
gimp_brush_core_get_brush_mask (GimpBrushCore *core,
const GimpCoords *coords,
- GeglNode *op,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_force)
{
@@ -1058,7 +1087,7 @@ gimp_brush_core_get_brush_mask (GimpBrushCore *core,
if (dynamic_force <= 0.0)
return NULL;
- mask = gimp_brush_core_transform_mask (core, core->brush, op);
+ mask = gimp_brush_core_transform_mask (core, core->brush);
if (! mask)
return NULL;
@@ -1089,8 +1118,7 @@ gimp_brush_core_get_brush_mask (GimpBrushCore *core,
}
const GimpTempBuf *
-gimp_brush_core_get_brush_pixmap (GimpBrushCore *core,
- GeglNode *op)
+gimp_brush_core_get_brush_pixmap (GimpBrushCore *core)
{
const GimpTempBuf *pixmap;
@@ -1098,11 +1126,10 @@ gimp_brush_core_get_brush_pixmap (GimpBrushCore *core,
return NULL;
pixmap = gimp_brush_transform_pixmap (core->brush,
- op,
core->scale,
core->aspect_ratio,
- core->angle,
- core->reflect,
+ gimp_brush_core_get_angle (core),
+ gimp_brush_core_get_reflect (core),
core->hardness);
if (pixmap == core->transform_pixmap)
@@ -1212,11 +1239,32 @@ gimp_brush_core_eval_transform_dynamics (GimpBrushCore *core,
}
}
+void
+gimp_brush_core_eval_transform_symmetry (GimpBrushCore *core,
+ GimpSymmetry *symmetry,
+ gint stroke)
+{
+ g_return_if_fail (GIMP_IS_BRUSH_CORE (core));
+ g_return_if_fail (symmetry == NULL || GIMP_IS_SYMMETRY (symmetry));
+
+ core->symmetry_angle = 0.0;
+ core->symmetry_reflect = FALSE;
+
+ if (symmetry)
+ {
+ gimp_symmetry_get_transform (symmetry,
+ stroke,
+ &core->symmetry_angle,
+ &core->symmetry_reflect);
+
+ core->symmetry_angle /= 360.0;
+ }
+}
+
void
gimp_brush_core_color_area_with_pixmap (GimpBrushCore *core,
GimpDrawable *drawable,
const GimpCoords *coords,
- GeglNode *op,
GeglBuffer *area,
gint area_x,
gint area_y,
@@ -1237,13 +1285,13 @@ gimp_brush_core_color_area_with_pixmap (GimpBrushCore *core,
g_return_if_fail (gimp_brush_get_pixmap (core->brush) != NULL);
/* scale the brush */
- pixmap = gimp_brush_core_get_brush_pixmap (core, op);
+ pixmap = gimp_brush_core_get_brush_pixmap (core);
if (! pixmap)
return;
if (apply_mask)
- mask = gimp_brush_core_transform_mask (core, core->brush, op);
+ mask = gimp_brush_core_transform_mask (core, core->brush);
else
mask = NULL;
diff --git a/app/paint/gimpbrushcore.h b/app/paint/gimpbrushcore.h
index 662c3229fa..3ba4a41984 100644
--- a/app/paint/gimpbrushcore.h
+++ b/app/paint/gimpbrushcore.h
@@ -51,6 +51,9 @@ struct _GimpBrushCore
gboolean reflect;
gdouble hardness;
+ gdouble symmetry_angle;
+ gboolean symmetry_reflect;
+
/* brush buffers */
GimpTempBuf *pressure_brush;
@@ -108,8 +111,7 @@ void gimp_brush_core_paste_canvas (GimpBrushCore *core,
GimpLayerMode paint_mode,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_hardness,
- GimpPaintApplicationMode mode,
- GeglNode *op);
+ GimpPaintApplicationMode mode);
void gimp_brush_core_replace_canvas (GimpBrushCore *core,
GimpDrawable *drawable,
const GimpCoords *coords,
@@ -117,14 +119,12 @@ void gimp_brush_core_replace_canvas (GimpBrushCore *core,
gdouble image_opacity,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_hardness,
- GimpPaintApplicationMode mode,
- GeglNode *op);
+ GimpPaintApplicationMode mode);
void gimp_brush_core_color_area_with_pixmap
(GimpBrushCore *core,
GimpDrawable *drawable,
const GimpCoords *coords,
- GeglNode *op,
GeglBuffer *area,
gint area_x,
gint area_y,
@@ -133,18 +133,20 @@ void gimp_brush_core_color_area_with_pixmap
const GimpTempBuf * gimp_brush_core_get_brush_mask
(GimpBrushCore *core,
const GimpCoords *coords,
- GeglNode *op,
GimpBrushApplicationMode brush_hardness,
gdouble dynamic_hardness);
const GimpTempBuf * gimp_brush_core_get_brush_pixmap
- (GimpBrushCore *core,
- GeglNode *op);
+ (GimpBrushCore *core);
void gimp_brush_core_eval_transform_dynamics
- (GimpBrushCore *paint_core,
+ (GimpBrushCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords);
+void gimp_brush_core_eval_transform_symmetry
+ (GimpBrushCore *core,
+ GimpSymmetry *symmetry,
+ gint stroke);
#endif /* __GIMP_BRUSH_CORE_H__ */
diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c
index bafb1845a1..24b32e187a 100644
--- a/app/paint/gimpclone.c
+++ b/app/paint/gimpclone.c
@@ -251,8 +251,7 @@ gimp_clone_motion (GimpSourceCore *source_core,
*/
source_options->align_mode ==
GIMP_SOURCE_ALIGN_FIXED ?
- GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT,
- NULL);
+ GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
}
static gboolean
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index 1d1b8a80c1..f2eea47cb6 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -139,7 +139,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
gdouble opacity;
gdouble rate;
const GimpCoords *coords;
- GeglNode *op;
gint paint_width, paint_height;
gint n_strokes;
gint i;
@@ -165,6 +164,8 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
{
coords = gimp_symmetry_get_coords (sym, i);
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options,
GIMP_LAYER_MODE_NORMAL,
@@ -176,10 +177,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- op = gimp_symmetry_get_operation (sym, i,
- paint_width,
- paint_height);
-
rate = (options->rate *
gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE,
@@ -228,7 +225,7 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
1.0,
- GIMP_PAINT_INCREMENTAL, op);
+ GIMP_PAINT_INCREMENTAL);
}
}
diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c
index 86a9754736..cdfc176443 100644
--- a/app/paint/gimpdodgeburn.c
+++ b/app/paint/gimpdodgeburn.c
@@ -112,10 +112,11 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options,
GimpSymmetry *sym)
{
- GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_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));
+ GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
+ GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_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 *src_buffer;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
@@ -124,7 +125,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
gdouble opacity;
gdouble force;
const GimpCoords *coords;
- GeglNode *op;
gint paint_width, paint_height;
gint n_strokes;
gint i;
@@ -146,7 +146,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
else
src_buffer = gimp_drawable_get_buffer (drawable);
- gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
+ gimp_brush_core_eval_transform_dynamics (brush_core,
drawable,
paint_options,
coords);
@@ -155,6 +155,8 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
{
coords = gimp_symmetry_get_coords (sym, i);
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options,
GIMP_LAYER_MODE_NORMAL,
@@ -166,10 +168,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- op = gimp_symmetry_get_operation (sym, i,
- paint_width,
- paint_height);
-
/* DodgeBurn the region */
gimp_gegl_dodgeburn (src_buffer,
GEGL_RECTANGLE (paint_buffer_x,
@@ -198,7 +196,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
force,
- paint_options->application_mode,
- op);
+ paint_options->application_mode);
}
}
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 1074591ddc..37732603de 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -123,10 +123,11 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options,
GimpSymmetry *sym)
{
- 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));
+ GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
+ 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;
GimpLayerMode paint_mode;
@@ -137,7 +138,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
GeglColor *color;
gdouble force;
const GimpCoords *coords;
- GeglNode *op;
gint n_strokes;
gint paint_width, paint_height;
gint i;
@@ -166,7 +166,7 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
else
paint_mode = GIMP_LAYER_MODE_NORMAL_LEGACY;
- gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
+ gimp_brush_core_eval_transform_dynamics (brush_core,
drawable,
paint_options,
coords);
@@ -176,6 +176,8 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
{
coords = gimp_symmetry_get_coords (sym, i);
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
if (gimp_dynamics_is_output_enabled (dynamics, GIMP_DYNAMICS_OUTPUT_FORCE))
force = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE,
@@ -197,10 +199,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- op = gimp_symmetry_get_operation (sym, i,
- paint_width,
- paint_height);
-
gegl_buffer_set_color (paint_buffer, NULL, color);
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
@@ -210,7 +208,7 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
paint_mode,
gimp_paint_options_get_brush_mode (paint_options),
force,
- paint_options->application_mode, op);
+ paint_options->application_mode);
}
g_object_unref (color);
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index bc0f5c09d2..c4e9ada09d 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -540,7 +540,7 @@ gimp_heal_motion (GimpSourceCore *source_core,
force = paint_options->brush_force;
mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
- coords, op,
+ coords,
GIMP_BRUSH_HARD,
force);
@@ -654,5 +654,5 @@ gimp_heal_motion (GimpSourceCore *source_core,
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
force,
- GIMP_PAINT_INCREMENTAL, NULL);
+ GIMP_PAINT_INCREMENTAL);
}
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 2c1ced0b65..321d4933eb 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -160,7 +160,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
gdouble grad_point;
gdouble force;
const GimpCoords *coords;
- GeglNode *op;
gint n_strokes;
gint i;
@@ -207,6 +206,9 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords = gimp_symmetry_get_coords (sym, i);
+ if (GIMP_BRUSH_CORE_GET_CLASS (brush_core)->handles_transforming_brush)
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options,
paint_mode,
@@ -218,9 +220,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- op = gimp_symmetry_get_operation (sym, i,
- paint_width,
- paint_height);
if (gimp_paint_options_get_gradient_color (paint_options, image,
grad_point,
paint_core->pixel_dist,
@@ -237,7 +236,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
/* otherwise check if the brush has a pixmap and use that to
* color the area
*/
- paint_pixmap = gimp_brush_core_get_brush_pixmap (brush_core, op);
+ paint_pixmap = gimp_brush_core_get_brush_pixmap (brush_core);
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
}
@@ -290,7 +289,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
if (paint_pixmap)
{
gimp_brush_core_color_area_with_pixmap (brush_core, drawable,
- coords, op,
+ coords,
paint_buffer,
paint_buffer_x,
paint_buffer_y,
@@ -329,6 +328,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
paint_mode,
gimp_paint_options_get_brush_mode (paint_options),
force,
- paint_appl_mode, op);
+ paint_appl_mode);
}
}
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index 2832000d4c..224d3f0326 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -205,9 +205,10 @@ gimp_smudge_start (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options,
GimpSymmetry *sym)
{
- GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
- GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
+ GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
+ GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpPickable *dest_pickable;
GeglBuffer *pickable_buffer;
GeglBuffer *paint_buffer;
@@ -222,7 +223,7 @@ gimp_smudge_start (GimpPaintCore *paint_core,
gint x, y;
coords = gimp_symmetry_get_origin (sym);
- gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
+ gimp_brush_core_eval_transform_dynamics (brush_core,
drawable,
paint_options,
coords);
@@ -362,7 +363,6 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
/* other variables */
gdouble force;
GimpCoords *coords;
- GeglNode *op;
gint paint_width, paint_height;
gint n_strokes;
gint i;
@@ -395,7 +395,7 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
if (opacity == 0.0)
return;
- gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
+ gimp_brush_core_eval_transform_dynamics (brush_core,
drawable,
paint_options,
coords);
@@ -451,6 +451,8 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
{
coords = gimp_symmetry_get_coords (sym, i);
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options,
GIMP_LAYER_MODE_NORMAL,
@@ -462,10 +464,6 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- op = gimp_symmetry_get_operation (sym, i,
- paint_width,
- paint_height);
-
paint_buffer_width = gegl_buffer_get_width (paint_buffer);
paint_buffer_height = gegl_buffer_get_height (paint_buffer);
@@ -497,7 +495,7 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
if (! brush_color_ptr && flow > 0.0)
{
gimp_brush_core_color_area_with_pixmap (brush_core, drawable,
- coords, op,
+ coords,
paint_buffer,
paint_buffer_x,
paint_buffer_y,
@@ -537,7 +535,7 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
force,
- GIMP_PAINT_INCREMENTAL, op);
+ GIMP_PAINT_INCREMENTAL);
}
}
diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c
index c203288dca..bfa81d20ed 100644
--- a/app/paint/gimpsourcecore.c
+++ b/app/paint/gimpsourcecore.c
@@ -359,6 +359,7 @@ gimp_source_core_motion (GimpSourceCore *source_core,
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
+ GimpBrushCore *brush_core = GIMP_BRUSH_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));
@@ -420,7 +421,7 @@ gimp_source_core_motion (GimpSourceCore *source_core,
}
}
- gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
+ gimp_brush_core_eval_transform_dynamics (brush_core,
drawable,
paint_options,
origin);
@@ -432,6 +433,8 @@ gimp_source_core_motion (GimpSourceCore *source_core,
{
coords = gimp_symmetry_get_coords (sym, i);
+ gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);
+
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options,
paint_mode,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]