Commit 336c5c20 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

restored old time/speed sensitivity behaviour by doing nothing except

2004-05-26  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimpink.c: restored old time/speed sensitivity
	behaviour by doing nothing except figuring if we draw a straight
	line in INIT_PAINT. Instead, do all the Blob creating in
	MOTION_PAINT and special case the initial (null) "motion"
	accordingly.
parent c679e9d0
2004-05-26 Michael Natterer <mitch@gimp.org>
* app/paint/gimpink.c: restored old time/speed sensitivity
behaviour by doing nothing except figuring if we draw a straight
line in INIT_PAINT. Instead, do all the Blob creating in
MOTION_PAINT and special case the initial (null) "motion"
accordingly.
2004-05-26 Maurits Rijk <m.rijk@chello.nl> 2004-05-26 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/video.c: code clean-up. Twice as fast now. * plug-ins/common/video.c: code clean-up. Twice as fast now.
......
...@@ -170,7 +170,6 @@ gimp_ink_paint (GimpPaintCore *paint_core, ...@@ -170,7 +170,6 @@ gimp_ink_paint (GimpPaintCore *paint_core,
guint32 time) guint32 time)
{ {
GimpInk *ink = GIMP_INK (paint_core); GimpInk *ink = GIMP_INK (paint_core);
GimpInkOptions *options = GIMP_INK_OPTIONS (paint_options);
switch (paint_state) switch (paint_state)
{ {
...@@ -181,7 +180,6 @@ gimp_ink_paint (GimpPaintCore *paint_core, ...@@ -181,7 +180,6 @@ gimp_ink_paint (GimpPaintCore *paint_core,
break; break;
case INIT_PAINT: case INIT_PAINT:
{
if (ink->last_blob && if (ink->last_blob &&
paint_core->cur_coords.x == paint_core->last_coords.x && paint_core->cur_coords.x == paint_core->last_coords.x &&
paint_core->cur_coords.y == paint_core->last_coords.y) paint_core->cur_coords.y == paint_core->last_coords.y)
...@@ -190,25 +188,6 @@ gimp_ink_paint (GimpPaintCore *paint_core, ...@@ -190,25 +188,6 @@ gimp_ink_paint (GimpPaintCore *paint_core,
g_free (ink->last_blob); g_free (ink->last_blob);
ink->last_blob = NULL; ink->last_blob = NULL;
} }
if (! ink->last_blob)
ink->last_blob = ink_pen_ellipse (options,
paint_core->cur_coords.x,
paint_core->cur_coords.y,
paint_core->cur_coords.pressure,
paint_core->cur_coords.xtilt,
paint_core->cur_coords.ytilt,
10.0);
time_smoother_init (ink, time);
ink->last_time = time;
dist_smoother_init (ink, 0.0);
ink->init_velocity = TRUE;
ink->lastx = paint_core->cur_coords.x;
ink->lasty = paint_core->cur_coords.y;
}
break; break;
case MOTION_PAINT: case MOTION_PAINT:
...@@ -268,29 +247,54 @@ gimp_ink_motion (GimpPaintCore *paint_core, ...@@ -268,29 +247,54 @@ gimp_ink_motion (GimpPaintCore *paint_core,
GimpInkOptions *options = GIMP_INK_OPTIONS (paint_options); GimpInkOptions *options = GIMP_INK_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options); GimpContext *context = GIMP_CONTEXT (paint_options);
GimpImage *gimage; GimpImage *gimage;
Blob *blob; Blob *blob_union = NULL;
Blob *blob_union; Blob *blob_to_render;
gdouble velocity;
gdouble dist;
gdouble lasttime, thistime;
TempBuf *area; TempBuf *area;
guchar col[MAX_CHANNELS]; guchar col[MAX_CHANNELS];
PixelRegion blob_maskPR; PixelRegion blob_maskPR;
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); gimage = gimp_item_get_image (GIMP_ITEM (drawable));
if (! ink->last_blob)
{
ink->last_blob = ink_pen_ellipse (options,
paint_core->cur_coords.x,
paint_core->cur_coords.y,
paint_core->cur_coords.pressure,
paint_core->cur_coords.xtilt,
paint_core->cur_coords.ytilt,
10.0);
time_smoother_init (ink, time);
ink->last_time = time;
dist_smoother_init (ink, 0.0);
ink->init_velocity = TRUE;
ink->lastx = paint_core->cur_coords.x;
ink->lasty = paint_core->cur_coords.y;
blob_to_render = ink->last_blob;
}
else
{
Blob *blob;
gdouble lasttime, thistime;
gdouble dist;
gdouble velocity;
lasttime = ink->last_time; lasttime = ink->last_time;
time_smoother_add (ink, time); time_smoother_add (ink, time);
thistime = ink->last_time = time_smoother_result (ink); thistime = ink->last_time = time_smoother_result (ink);
/* The time resolution on X-based GDK motion events is /* The time resolution on X-based GDK motion events is bloody
bloody awful, hence the use of the smoothing function. * awful, hence the use of the smoothing function. Sadly this
Sadly this also means that there is always the chance of * also means that there is always the chance of having an
having an indeterminite velocity since this event and * indeterminite velocity since this event and the previous
the previous several may still appear to issue at the same * several may still appear to issue at the same
instant. -ADM */ * instant. -ADM
*/
if (thistime == lasttime) if (thistime == lasttime)
thistime = lasttime + 1; thistime = lasttime + 1;
...@@ -327,8 +331,11 @@ gimp_ink_motion (GimpPaintCore *paint_core, ...@@ -327,8 +331,11 @@ gimp_ink_motion (GimpPaintCore *paint_core,
g_free (ink->last_blob); g_free (ink->last_blob);
ink->last_blob = blob; ink->last_blob = blob;
blob_to_render = blob_union;
}
/* Get the the buffer */ /* Get the the buffer */
ink->blob = blob_union; ink->blob = blob_to_render;
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options); area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
if (! area) if (! area)
...@@ -357,7 +364,7 @@ gimp_ink_motion (GimpPaintCore *paint_core, ...@@ -357,7 +364,7 @@ gimp_ink_motion (GimpPaintCore *paint_core,
paint_core->canvas_buf->height, paint_core->canvas_buf->height,
TRUE); TRUE);
render_blob (blob_union, &blob_maskPR); render_blob (blob_to_render, &blob_maskPR);
/* draw the canvas_buf using the just rendered canvas_tiles as mask */ /* draw the canvas_buf using the just rendered canvas_tiles as mask */
pixel_region_init (&blob_maskPR, paint_core->canvas_tiles, pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
...@@ -373,6 +380,7 @@ gimp_ink_motion (GimpPaintCore *paint_core, ...@@ -373,6 +380,7 @@ gimp_ink_motion (GimpPaintCore *paint_core,
gimp_context_get_paint_mode (context), gimp_context_get_paint_mode (context),
GIMP_PAINT_CONSTANT); GIMP_PAINT_CONSTANT);
if (blob_union)
g_free (blob_union); g_free (blob_union);
} }
......
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