Commit 9a5b21cc authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent 7b77ffc1
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> 2004-05-19 Sven Neumann <sven@gimp.org>
* plug-ins/common/channel_mixer.c: added some stock icons. * plug-ins/common/channel_mixer.c: added some stock icons.
......
...@@ -735,7 +735,8 @@ gimp_paint_core_interpolate (GimpPaintCore *core, ...@@ -735,7 +735,8 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
/* FIXME: need to adapt the spacing to the size */ /* FIXME: need to adapt the spacing to the size */
/* lastscale = MIN (gimp_paint_tool->lastpressure, 1/256); */ /* lastscale = MIN (gimp_paint_tool->lastpressure, 1/256); */
/* curscale = MIN (gimp_paint_tool->curpressure, 1/256); */ /* curscale = MIN (gimp_paint_tool->curpressure, 1/256); */
/* spacing = gimp_paint_tool->spacing * sqrt (0.5 * (lastscale + curscale)); */ /* spacing = */
/* gimp_paint_tool->spacing * sqrt (0.5 * (lastscale + curscale)); */
/* Compute spacing parameters such that a brush position will be /* Compute spacing parameters such that a brush position will be
* made each time the line crosses the *center* of a pixel row or * made each time the line crosses the *center* of a pixel row or
...@@ -886,11 +887,16 @@ gimp_paint_core_interpolate (GimpPaintCore *core, ...@@ -886,11 +887,16 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
for (n = 0; n < num_points; n++) for (n = 0; n < num_points; n++)
{ {
GimpBrush *current_brush; GimpBrush *current_brush;
gdouble pressure;
gdouble t = t0 + n*dt; gdouble t = t0 + n*dt;
core->cur_coords.x = core->last_coords.x + t * delta_vec.x; 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.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.xtilt = core->last_coords.xtilt + t * delta_xtilt;
core->cur_coords.ytilt = core->last_coords.ytilt + t * delta_ytilt; core->cur_coords.ytilt = core->last_coords.ytilt + t * delta_ytilt;
core->cur_coords.wheel = core->last_coords.wheel + t * delta_wheel; core->cur_coords.wheel = core->last_coords.wheel + t * delta_wheel;
...@@ -918,7 +924,6 @@ gimp_paint_core_interpolate (GimpPaintCore *core, ...@@ -918,7 +924,6 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
core->pixel_dist = pixel_initial + pixel_dist; core->pixel_dist = pixel_initial + pixel_dist;
core->last_coords = core->cur_coords; core->last_coords = core->cur_coords;
} }
......
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