|
1 | 1 | #ifndef lint
|
2 |
| -static char *RCSid() { return RCSid("$Id: gadgets.c,v 1.140 2017-08-01 01:19:37 sfeam Exp $"); } |
| 2 | +static char *RCSid() { return RCSid("$Id: gadgets.c,v 1.141 2017-10-31 18:51:23 sfeam Exp $"); } |
3 | 3 | #endif
|
4 | 4 |
|
5 | 5 | /* GNUPLOT - gadgets.c */
|
@@ -253,8 +253,7 @@ draw_clip_line(int x1, int y1, int x2, int y2)
|
253 | 253 | struct termentry *t = term;
|
254 | 254 |
|
255 | 255 | if (!clip_line(&x1, &y1, &x2, &y2))
|
256 |
| - /* clip_line() returns zero --> segment completely outside |
257 |
| - * bounding box */ |
| 256 | + /* clip_line() returns zero if segment completely outside bounding box */ |
258 | 257 | return;
|
259 | 258 |
|
260 | 259 | (*t->move) (x1, y1);
|
@@ -318,11 +317,11 @@ draw_clip_arrow( int sx, int sy, int ex, int ey, int head)
|
318 | 317 | head &= ~BACKHEAD;
|
319 | 318 | if (clip_point(ex,ey))
|
320 | 319 | head &= ~END_HEAD;
|
321 |
| - clip_line(&sx, &sy, &ex, &ey); |
322 | 320 |
|
323 |
| - /* Call terminal routine to draw the clipped arrow */ |
324 |
| - (*t->arrow)((unsigned int)sx, (unsigned int)sy, |
325 |
| - (unsigned int)ex, (unsigned int)ey, head); |
| 321 | + /* clip_line returns 0 if the whole thing is out of range */ |
| 322 | + if (clip_line(&sx, &sy, &ex, &ey)) |
| 323 | + (*t->arrow)((unsigned int)sx, (unsigned int)sy, |
| 324 | + (unsigned int)ex, (unsigned int)ey, head); |
326 | 325 | }
|
327 | 326 |
|
328 | 327 | /* Clip the given line to drawing coords defined by BoundingBox.
|
@@ -428,11 +427,6 @@ clip_line(int *x1, int *y1, int *x2, int *y2)
|
428 | 427 | *y2 = y_intr[1];
|
429 | 428 | }
|
430 | 429 | } else if (pos1) { /* Only x1/y1 was out - update only it */
|
431 |
| - /* Nov 2010: When clip_line() and draw_clip_line() were consolidated in */ |
432 |
| - /* 2000, the test below was the only point of difference between them. */ |
433 |
| - /* Unfortunately, the wrong version was kept. Now I change it back. */ |
434 |
| - /* The effect of the wrong version (>= rather than >) was that a line */ |
435 |
| - /* from ymin to ymax+eps was clipped to ymin,ymin rather than ymin,ymax */ |
436 | 430 | if (dx * (*x2 - x_intr[0]) + dy * (*y2 - y_intr[0]) > 0) {
|
437 | 431 | *x1 = x_intr[0];
|
438 | 432 | *y1 = y_intr[0];
|
|
0 commit comments