fix pull request #492 - select_do_line of a point
Latent bug: selection_do_line() for a single point produced spurious line(s). I haven't got a test case so am taking this one on faith.... While in there, do some nearby formatting fixups in sp_lev.c. Fixes #492
This commit is contained in:
28
src/sp_lev.c
28
src/sp_lev.c
@@ -4600,9 +4600,9 @@ selection_do_gradient(
|
||||
/* bresenham line algo */
|
||||
void
|
||||
selection_do_line(
|
||||
xchar x1, xchar y1,
|
||||
xchar x2, xchar y2,
|
||||
struct selectionvar *ov)
|
||||
xchar x1, xchar y1,
|
||||
xchar x2, xchar y2,
|
||||
struct selectionvar *ov)
|
||||
{
|
||||
int d0, dx, dy, ai, bi, xi, yi;
|
||||
|
||||
@@ -4613,7 +4613,6 @@ struct selectionvar *ov)
|
||||
xi = -1;
|
||||
dx = x1 - x2;
|
||||
}
|
||||
|
||||
if (y1 < y2) {
|
||||
yi = 1;
|
||||
dy = y2 - y1;
|
||||
@@ -4624,7 +4623,10 @@ struct selectionvar *ov)
|
||||
|
||||
selection_setpoint(x1, y1, ov, 1);
|
||||
|
||||
if (dx > dy) {
|
||||
if (!dx && !dy) {
|
||||
/* single point - already all done */
|
||||
;
|
||||
} else if (dx > dy) {
|
||||
ai = (dy - dx) * 2;
|
||||
bi = dy * 2;
|
||||
d0 = bi - dx;
|
||||
@@ -4655,11 +4657,11 @@ struct selectionvar *ov)
|
||||
|
||||
void
|
||||
selection_do_randline(
|
||||
xchar x1, xchar y1,
|
||||
xchar x2, xchar y2,
|
||||
schar rough,
|
||||
schar rec,
|
||||
struct selectionvar *ov)
|
||||
xchar x1, xchar y1,
|
||||
xchar x2, xchar y2,
|
||||
schar rough,
|
||||
schar rec,
|
||||
struct selectionvar *ov)
|
||||
{
|
||||
int mx, my;
|
||||
int dx, dy;
|
||||
@@ -4698,9 +4700,9 @@ struct selectionvar *ov)
|
||||
|
||||
static void
|
||||
selection_iterate(
|
||||
struct selectionvar *ov,
|
||||
select_iter_func func,
|
||||
genericptr_t arg)
|
||||
struct selectionvar *ov,
|
||||
select_iter_func func,
|
||||
genericptr_t arg)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user