diff --git a/ChangeLog b/ChangeLog index d58da76c50..c5684571a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 25 23:37:48 1999 Jay Cox (jaycox@earthlink.net) + + * paint_core.c: fixed longstanding roundoff error in + paint_core_subsample_mask. A couple of minor code cleanups. + 1999-07-24 Michael Natterer * app/errorconsole.[ch]: forgot to checkin this one... diff --git a/app/paint_core.c b/app/paint_core.c index d70db9926c..19d99061dd 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -592,11 +592,7 @@ paint_core_init (PaintCore *paint_core, NULL); paint_core->spacing = (double) gimp_brush_get_spacing (brush) / 100.0; -/* paint_core->spacing = - (double) MAXIMUM (brush->mask->width, brush->mask->height) * - ((double) gimp_brush_get_spacing (brush) / 100.0); - if (paint_core->spacing < 1.0) - paint_core->spacing = 1.0; */ + paint_core->brush = brush; /* free the block structures */ @@ -718,15 +714,16 @@ paint_core_interpolate (PaintCore *paint_core, dxtilt = paint_core->curxtilt - paint_core->lastxtilt; dytilt = paint_core->curytilt - paint_core->lastytilt; +/* return if there has been no motion */ if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt) return; +/* calculate the distance traveled in the coordinate space of the brush */ mag = vector2d_magnitude (&(paint_core->brush->x_axis)); xd = vector2d_dot_product(&delta, &(paint_core->brush->x_axis)) / (mag*mag); mag = vector2d_magnitude (&(paint_core->brush->y_axis)); - yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / - SQR(vector2d_magnitude(&(paint_core->brush->y_axis))); + yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / (mag*mag); dist = .5 * sqrt (xd*xd + yd*yd); @@ -1055,7 +1052,7 @@ paint_core_subsample_mask (MaskBuf *mask, s = KERNEL_WIDTH; while (s--) { - new_val = *d + ((*m * *k++) >> 8); + new_val = *d + ((*m * *k++) /255); *d++ = MINIMUM (new_val, 255); } } diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index d70db9926c..19d99061dd 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -592,11 +592,7 @@ paint_core_init (PaintCore *paint_core, NULL); paint_core->spacing = (double) gimp_brush_get_spacing (brush) / 100.0; -/* paint_core->spacing = - (double) MAXIMUM (brush->mask->width, brush->mask->height) * - ((double) gimp_brush_get_spacing (brush) / 100.0); - if (paint_core->spacing < 1.0) - paint_core->spacing = 1.0; */ + paint_core->brush = brush; /* free the block structures */ @@ -718,15 +714,16 @@ paint_core_interpolate (PaintCore *paint_core, dxtilt = paint_core->curxtilt - paint_core->lastxtilt; dytilt = paint_core->curytilt - paint_core->lastytilt; +/* return if there has been no motion */ if (!delta.x && !delta.y && !dpressure && !dxtilt && !dytilt) return; +/* calculate the distance traveled in the coordinate space of the brush */ mag = vector2d_magnitude (&(paint_core->brush->x_axis)); xd = vector2d_dot_product(&delta, &(paint_core->brush->x_axis)) / (mag*mag); mag = vector2d_magnitude (&(paint_core->brush->y_axis)); - yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / - SQR(vector2d_magnitude(&(paint_core->brush->y_axis))); + yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / (mag*mag); dist = .5 * sqrt (xd*xd + yd*yd); @@ -1055,7 +1052,7 @@ paint_core_subsample_mask (MaskBuf *mask, s = KERNEL_WIDTH; while (s--) { - new_val = *d + ((*m * *k++) >> 8); + new_val = *d + ((*m * *k++) /255); *d++ = MINIMUM (new_val, 255); } }