Commit 15c23927 authored by Simon Budig's avatar Simon Budig Committed by Sven Neumann
Browse files

use floor() before casting to gint when calculating the current brush

2001-01-02  Simon Budig  <simon@gimp.org>

	* app/paint_core.c: use floor() before casting to gint when
	calculating the current brush coordinates. Fixes the jagged brush
	stroke when stroking a path that leaves the image at the top or left
	edge (bug #6043).

telephone-committed by Sven <sven@gimp.org>
parent 589a5476
2001-01-02 Simon Budig <simon@gimp.org>
* app/paint_core.c: use floor() before casting to gint when
calculating the current brush coordinates. Fixes the jagged brush
stroke when stroking a path that leaves the image at the top or left
edge (bug #6043).
2001-01-02 Daniel Egger <egger@suse.de> 2001-01-02 Daniel Egger <egger@suse.de>
* app/clone.c: * app/clone.c:
......
...@@ -1065,8 +1065,8 @@ paint_core_get_paint_area (PaintCore *paint_core, ...@@ -1065,8 +1065,8 @@ paint_core_get_paint_area (PaintCore *paint_core,
&bwidth, &bheight); &bwidth, &bheight);
/* adjust the x and y coordinates to the upper left corner of the brush */ /* adjust the x and y coordinates to the upper left corner of the brush */
x = (gint) paint_core->curx - (bwidth >> 1); x = (gint) floor (paint_core->curx) - (bwidth >> 1);
y = (gint) paint_core->cury - (bheight >> 1); y = (gint) floor (paint_core->cury) - (bheight >> 1);
dwidth = drawable_width (drawable); dwidth = drawable_width (drawable);
dheight = drawable_height (drawable); dheight = drawable_height (drawable);
...@@ -1788,8 +1788,8 @@ brush_to_canvas_tiles (PaintCore *paint_core, ...@@ -1788,8 +1788,8 @@ brush_to_canvas_tiles (PaintCore *paint_core,
canvas_buf->x, canvas_buf->y, canvas_buf->x, canvas_buf->y,
canvas_buf->width, canvas_buf->height, TRUE); canvas_buf->width, canvas_buf->height, TRUE);
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1817,8 +1817,8 @@ brush_to_canvas_buf (PaintCore *paint_core, ...@@ -1817,8 +1817,8 @@ brush_to_canvas_buf (PaintCore *paint_core,
gint xoff; gint xoff;
gint yoff; gint yoff;
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1861,8 +1861,8 @@ paint_to_canvas_tiles (PaintCore *paint_core, ...@@ -1861,8 +1861,8 @@ paint_to_canvas_tiles (PaintCore *paint_core,
canvas_buf->x, canvas_buf->y, canvas_buf->x, canvas_buf->y,
canvas_buf->width, canvas_buf->height, TRUE); canvas_buf->width, canvas_buf->height, TRUE);
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1906,8 +1906,8 @@ paint_to_canvas_buf (PaintCore *paint_core, ...@@ -1906,8 +1906,8 @@ paint_to_canvas_buf (PaintCore *paint_core,
gint xoff; gint xoff;
gint yoff; gint yoff;
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -2059,8 +2059,8 @@ paint_core_color_area_with_pixmap (PaintCore *paint_core, ...@@ -2059,8 +2059,8 @@ paint_core_color_area_with_pixmap (PaintCore *paint_core,
* paint_core_get_paint_area. Ugly to have to do this here, too. * paint_core_get_paint_area. Ugly to have to do this here, too.
*/ */
ulx = (gint) paint_core->curx - (pixmap_mask->width >> 1); ulx = (gint) floor (paint_core->curx) - (pixmap_mask->width >> 1);
uly = (gint) paint_core->cury - (pixmap_mask->height >> 1); uly = (gint) floor (paint_core->cury) - (pixmap_mask->height >> 1);
offsetx = area->x - ulx; offsetx = area->x - ulx;
offsety = area->y - uly; offsety = area->y - uly;
......
...@@ -1065,8 +1065,8 @@ paint_core_get_paint_area (PaintCore *paint_core, ...@@ -1065,8 +1065,8 @@ paint_core_get_paint_area (PaintCore *paint_core,
&bwidth, &bheight); &bwidth, &bheight);
/* adjust the x and y coordinates to the upper left corner of the brush */ /* adjust the x and y coordinates to the upper left corner of the brush */
x = (gint) paint_core->curx - (bwidth >> 1); x = (gint) floor (paint_core->curx) - (bwidth >> 1);
y = (gint) paint_core->cury - (bheight >> 1); y = (gint) floor (paint_core->cury) - (bheight >> 1);
dwidth = drawable_width (drawable); dwidth = drawable_width (drawable);
dheight = drawable_height (drawable); dheight = drawable_height (drawable);
...@@ -1788,8 +1788,8 @@ brush_to_canvas_tiles (PaintCore *paint_core, ...@@ -1788,8 +1788,8 @@ brush_to_canvas_tiles (PaintCore *paint_core,
canvas_buf->x, canvas_buf->y, canvas_buf->x, canvas_buf->y,
canvas_buf->width, canvas_buf->height, TRUE); canvas_buf->width, canvas_buf->height, TRUE);
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1817,8 +1817,8 @@ brush_to_canvas_buf (PaintCore *paint_core, ...@@ -1817,8 +1817,8 @@ brush_to_canvas_buf (PaintCore *paint_core,
gint xoff; gint xoff;
gint yoff; gint yoff;
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1861,8 +1861,8 @@ paint_to_canvas_tiles (PaintCore *paint_core, ...@@ -1861,8 +1861,8 @@ paint_to_canvas_tiles (PaintCore *paint_core,
canvas_buf->x, canvas_buf->y, canvas_buf->x, canvas_buf->y,
canvas_buf->width, canvas_buf->height, TRUE); canvas_buf->width, canvas_buf->height, TRUE);
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -1906,8 +1906,8 @@ paint_to_canvas_buf (PaintCore *paint_core, ...@@ -1906,8 +1906,8 @@ paint_to_canvas_buf (PaintCore *paint_core,
gint xoff; gint xoff;
gint yoff; gint yoff;
x = (gint) paint_core->curx - (brush_mask->width >> 1); x = (gint) floor (paint_core->curx) - (brush_mask->width >> 1);
y = (gint) paint_core->cury - (brush_mask->height >> 1); y = (gint) floor (paint_core->cury) - (brush_mask->height >> 1);
xoff = (x < 0) ? -x : 0; xoff = (x < 0) ? -x : 0;
yoff = (y < 0) ? -y : 0; yoff = (y < 0) ? -y : 0;
...@@ -2059,8 +2059,8 @@ paint_core_color_area_with_pixmap (PaintCore *paint_core, ...@@ -2059,8 +2059,8 @@ paint_core_color_area_with_pixmap (PaintCore *paint_core,
* paint_core_get_paint_area. Ugly to have to do this here, too. * paint_core_get_paint_area. Ugly to have to do this here, too.
*/ */
ulx = (gint) paint_core->curx - (pixmap_mask->width >> 1); ulx = (gint) floor (paint_core->curx) - (pixmap_mask->width >> 1);
uly = (gint) paint_core->cury - (pixmap_mask->height >> 1); uly = (gint) floor (paint_core->cury) - (pixmap_mask->height >> 1);
offsetx = area->x - ulx; offsetx = area->x - ulx;
offsety = area->y - uly; offsety = area->y - uly;
......
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