make sure that pressure never becomes negative. Fixes bug #123811; thanks

2004-05-19  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): make
	sure that pressure never becomes negative. Fixes bug #123811;
	thanks to Philip Lafleur for investigating this problem.
This commit is contained in:
Sven Neumann
2004-05-19 10:33:47 +00:00
committed by Sven Neumann
parent 7b77ffc1b1
commit 9a5b21cc3f
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-05-19 Sven Neumann <sven@gimp.org>
* app/paint/gimppaintcore.c (gimp_paint_core_interpolate): make
sure that pressure never becomes negative. Fixes bug #123811;
thanks to Philip Lafleur for investigating this problem.
2004-05-19 Sven Neumann <sven@gimp.org>
* plug-ins/common/channel_mixer.c: added some stock icons.

View File

@ -732,10 +732,11 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
pixel_dist = gimp_vector2_length (&delta_vec);
pixel_initial = core->pixel_dist;
/* FIXME: need to adapt the spacing to the size */
/* lastscale = MIN (gimp_paint_tool->lastpressure, 1/256); */
/* curscale = MIN (gimp_paint_tool->curpressure, 1/256); */
/* spacing = gimp_paint_tool->spacing * sqrt (0.5 * (lastscale + curscale)); */
/* FIXME: need to adapt the spacing to the size */
/* lastscale = MIN (gimp_paint_tool->lastpressure, 1/256); */
/* curscale = MIN (gimp_paint_tool->curpressure, 1/256); */
/* spacing = */
/* gimp_paint_tool->spacing * sqrt (0.5 * (lastscale + curscale)); */
/* Compute spacing parameters such that a brush position will be
* made each time the line crosses the *center* of a pixel row or
@ -886,11 +887,16 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
for (n = 0; n < num_points; n++)
{
GimpBrush *current_brush;
gdouble pressure;
gdouble t = t0 + n*dt;
core->cur_coords.x = core->last_coords.x + t * delta_vec.x;
core->cur_coords.y = core->last_coords.y + t * delta_vec.y;
core->cur_coords.pressure = core->last_coords.pressure + t * delta_pressure;
/* avoid negative pressure, see bug #123811 */
pressure = core->last_coords.pressure + t * delta_pressure;
core->cur_coords.pressure = MAX (pressure, 0.0);
core->cur_coords.xtilt = core->last_coords.xtilt + t * delta_xtilt;
core->cur_coords.ytilt = core->last_coords.ytilt + t * delta_ytilt;
core->cur_coords.wheel = core->last_coords.wheel + t * delta_wheel;
@ -918,7 +924,6 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
core->pixel_dist = pixel_initial + pixel_dist;
core->last_coords = core->cur_coords;
}