I put a hack into gimage_mask_stroke to work around roundoff errors in

paint_core_subsample_mask, addressing Ben Jackson's Stroked pixel bug.
This commit is contained in:
Raph Levien 1998-01-28 06:34:28 +00:00
parent 626883c2e1
commit 9c15ca2b09
3 changed files with 48 additions and 8 deletions

View File

@ -1,3 +1,9 @@
Tue Jan 27 22:31:00 PST 1998 Raph Levien <raph@acm.org>
* app/gimage_mask.c: hacked around fractional pixel errors in
paint_core_subsample_mask, fixing the "Stroked pixel bug" posted
by Ben Jackson on 14 Jan 1998 to gimp-developer.
Tue Jan 27 10:21:00 PST 1998 Raph Levien <raph@acm.org>
* app/gimage.c: fixed bug in image display with all channels

View File

@ -573,16 +573,33 @@ gimage_mask_stroke (gimage, drawable)
non_gui_paint_core.paint_func = gimage_mask_stroke_paint_func;
gimage_mask_stroking = TRUE;
non_gui_paint_core.startx = non_gui_paint_core.lastx = (stroke_segs[0].x1 - offx);
non_gui_paint_core.starty = non_gui_paint_core.lasty = (stroke_segs[0].y1 - offy);
/* Note added by Raph Levien, 27 Jan 1998
The subtraction of 0.125 is to compensate for imprecision in
paint_core_subsample_mask. Ben Jackson posted a patch on 14 Jan
1998 to gimp-developers which addresses the imprecision more
directly. However, I've chosen this quick hack instead because it
is a less drastic change, and has no impact on performance. By
contrast, Ben's patch builds 25 rather than 16 subsampled brush
masks.
I'm planning to rework the subsample mechanism anyway to make way
for the natural brushes. When that happens, I'll be sure to make
it round precisely, at which point these -0.125 offsets can come
out.
*/
non_gui_paint_core.startx = non_gui_paint_core.lastx = (stroke_segs[0].x1 - offx) - 0.125;
non_gui_paint_core.starty = non_gui_paint_core.lasty = (stroke_segs[0].y1 - offy) - 0.125;
seg = 0;
for (i = 0; i < num_strokes; i++)
{
while (stroke_segs[seg].x2 != -1)
{
non_gui_paint_core.curx = (stroke_segs[seg].x2 - offx);
non_gui_paint_core.cury = (stroke_segs[seg].y2 - offy);
non_gui_paint_core.curx = (stroke_segs[seg].x2 - offx - 0.125);
non_gui_paint_core.cury = (stroke_segs[seg].y2 - offy - 0.125);
paint_core_interpolate (&non_gui_paint_core, drawable);

View File

@ -573,16 +573,33 @@ gimage_mask_stroke (gimage, drawable)
non_gui_paint_core.paint_func = gimage_mask_stroke_paint_func;
gimage_mask_stroking = TRUE;
non_gui_paint_core.startx = non_gui_paint_core.lastx = (stroke_segs[0].x1 - offx);
non_gui_paint_core.starty = non_gui_paint_core.lasty = (stroke_segs[0].y1 - offy);
/* Note added by Raph Levien, 27 Jan 1998
The subtraction of 0.125 is to compensate for imprecision in
paint_core_subsample_mask. Ben Jackson posted a patch on 14 Jan
1998 to gimp-developers which addresses the imprecision more
directly. However, I've chosen this quick hack instead because it
is a less drastic change, and has no impact on performance. By
contrast, Ben's patch builds 25 rather than 16 subsampled brush
masks.
I'm planning to rework the subsample mechanism anyway to make way
for the natural brushes. When that happens, I'll be sure to make
it round precisely, at which point these -0.125 offsets can come
out.
*/
non_gui_paint_core.startx = non_gui_paint_core.lastx = (stroke_segs[0].x1 - offx) - 0.125;
non_gui_paint_core.starty = non_gui_paint_core.lasty = (stroke_segs[0].y1 - offy) - 0.125;
seg = 0;
for (i = 0; i < num_strokes; i++)
{
while (stroke_segs[seg].x2 != -1)
{
non_gui_paint_core.curx = (stroke_segs[seg].x2 - offx);
non_gui_paint_core.cury = (stroke_segs[seg].y2 - offy);
non_gui_paint_core.curx = (stroke_segs[seg].x2 - offx - 0.125);
non_gui_paint_core.cury = (stroke_segs[seg].y2 - offy - 0.125);
paint_core_interpolate (&non_gui_paint_core, drawable);