Commit 6cdf44d6 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

set core->jitter here for all brush-based paint tools.

2005-10-04  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimpbrushcore.c (gimp_brush_core_start): set
	core->jitter here for all brush-based paint tools.

	(gimp_brush_core_interpolate): cleanup.

	* app/paint/gimpbrushcore.h: removed trailing whitespace.

	* app/paint/gimpclone.c (gimp_clone_motion)
	* app/paint/gimppaintbrush.c (_gimp_paintbrush_motion): removed
	jitter stuff here.
parent 4f873415
2005-10-04 Michael Natterer <mitch@gimp.org>
* app/paint/gimpbrushcore.c (gimp_brush_core_start): set
core->jitter here for all brush-based paint tools.
(gimp_brush_core_interpolate): cleanup.
* app/paint/gimpbrushcore.h: removed trailing whitespace.
* app/paint/gimpclone.c (gimp_clone_motion)
* app/paint/gimppaintbrush.c (_gimp_paintbrush_motion): removed
jitter stuff here.
2005-10-04 Sven Neumann <sven@gimp.org>
* app/base/siox.c: another optimization by Tobias Lenz.
......
......@@ -374,6 +374,10 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
core->brush = core->main_brush;
core->jitter =
gimp_paint_options_get_jitter (paint_options,
gimp_item_get_image (GIMP_ITEM (drawable)));
return TRUE;
}
......@@ -420,8 +424,6 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
gdouble pixel_initial;
gdouble xd, yd;
gdouble mag;
gdouble jitter_x = 0.0;
gdouble jitter_y = 0.0;
gimp_avoid_exact_integer (&paint_core->last_coords.x);
gimp_avoid_exact_integer (&paint_core->last_coords.y);
......@@ -617,25 +619,33 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
gdouble t = t0 + n * dt;
gdouble p = (gdouble) n / num_points;
paint_core->cur_coords.x = (paint_core->last_coords.x +
t * delta_vec.x);
paint_core->cur_coords.y = (paint_core->last_coords.y +
t * delta_vec.y);
paint_core->cur_coords.pressure = (paint_core->last_coords.pressure +
p * delta_pressure);
paint_core->cur_coords.xtilt = (paint_core->last_coords.xtilt +
p * delta_xtilt);
paint_core->cur_coords.ytilt = (paint_core->last_coords.ytilt +
p * delta_ytilt);
paint_core->cur_coords.wheel = (paint_core->last_coords.wheel +
p * delta_wheel);
if (core->jitter > 0.0)
{
gdouble jitter_x;
gdouble jitter_y;
jitter_x = g_random_double_range (-core->jitter, core->jitter);
jitter_y = g_random_double_range (-core->jitter, core->jitter);
}
paint_core->cur_coords.x = paint_core->last_coords.x
+ t * delta_vec.x + (jitter_x * core->brush->x_axis.x);
paint_core->cur_coords.y = paint_core->last_coords.y
+ t * delta_vec.y + (jitter_y * core->brush->y_axis.y);
paint_core->cur_coords.pressure = paint_core->last_coords.pressure + p * delta_pressure;
paint_core->cur_coords.xtilt = paint_core->last_coords.xtilt + p * delta_xtilt;
paint_core->cur_coords.ytilt = paint_core->last_coords.ytilt + p * delta_ytilt;
paint_core->cur_coords.wheel = paint_core->last_coords.wheel + p * delta_wheel;
paint_core->cur_coords.x += jitter_x * core->brush->x_axis.x;
paint_core->cur_coords.y += jitter_y * core->brush->y_axis.y;
}
paint_core->distance = initial + t * dist;
paint_core->pixel_dist = pixel_initial + t * pixel_dist;
paint_core->distance = initial + t * dist;
paint_core->pixel_dist = pixel_initial + t * pixel_dist;
gimp_paint_core_paint (paint_core, drawable, paint_options,
GIMP_PAINT_STATE_MOTION, time);
......
......@@ -69,7 +69,7 @@ struct _GimpBrushCore
MaskBuf *last_brush_mask;
gboolean cache_invalid;
gdouble jitter;
/* don't use these... */
......
......@@ -262,20 +262,14 @@ gimp_clone_motion (GimpPaintCore *paint_core,
gdouble opacity;
gint offset_x;
gint offset_y;
gdouble jitter;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
opacity = gimp_paint_options_get_fade (paint_options, gimage,
paint_core->pixel_dist);
if (opacity == 0.0)
return;
jitter = gimp_paint_options_get_jitter (paint_options, gimage);
if (jitter > 0.0)
GIMP_BRUSH_CORE (clone)->jitter = jitter;
/* make local copies because we change them */
offset_x = clone->offset_x;
offset_y = clone->offset_y;
......
......@@ -144,7 +144,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
TempBuf *area;
guchar col[MAX_CHANNELS];
GimpPaintApplicationMode paint_appl_mode;
gdouble jitter;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -153,20 +152,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
if (opacity == 0.0)
return;
jitter = gimp_paint_options_get_jitter (paint_options, gimage);
if (jitter > 0.0)
{
/*
* jitter_x = g_random_double_range(-jitter, jitter);
* jitter_y = g_random_double_range(-jitter, jitter);
*/
GIMP_BRUSH_CORE (brush_core)->jitter = jitter;
#if 0
GIMP_PAINT_CORE (brush_core)->cur_coords.y
= paint_core->last_coords.y + (jitter_y * brush_core->brush->y_axis.y);
#endif
}
paint_appl_mode = paint_options->application_mode;
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
......
......@@ -262,20 +262,14 @@ gimp_clone_motion (GimpPaintCore *paint_core,
gdouble opacity;
gint offset_x;
gint offset_y;
gdouble jitter;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
opacity = gimp_paint_options_get_fade (paint_options, gimage,
paint_core->pixel_dist);
if (opacity == 0.0)
return;
jitter = gimp_paint_options_get_jitter (paint_options, gimage);
if (jitter > 0.0)
GIMP_BRUSH_CORE (clone)->jitter = jitter;
/* make local copies because we change them */
offset_x = clone->offset_x;
offset_y = clone->offset_y;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment