| 601 | // is a specified a skip factor, which allows drawing dashed lines. |
| 602 | |
| 603 | void DrawDash(int x1, int y1, int x2, int y2, int skip) |
| 604 | { |
| 605 | int x, y, i, dx, dy, xInc, yInc, xInc2, yInc2, d, dInc, z, zMax; |
| 606 | |
| 607 | if (skip < 0) |
| 608 | skip = 0; |
| 609 | else if (skip > 0 && gs.fThick) |
| 610 | skip++; |
| 611 | #ifdef ISG |
| 612 | if (!gi.fFile) { |
| 613 | if (!skip) { |
| 614 | #ifdef X11 |
| 615 | // For non-dashed X window lines, have the Xlib do it. |
| 616 | |
| 617 | XDrawLine(gi.disp, gi.pmap, gi.gc, x1, y1, x2, y2); |
| 618 | // Some XDrawLine implementations don't draw the last pixel. |
| 619 | XDrawPoint(gi.disp, gi.pmap, gi.gc, x2, y2); |
| 620 | if (gs.fThick) { |
| 621 | // Make the line thicker by drawing it four times. |
| 622 | XDrawLine(gi.disp, gi.pmap, gi.gc, x1+1, y1, x2+1, y2); |
| 623 | XDrawLine(gi.disp, gi.pmap, gi.gc, x1, y1+1, x2, y2+1); |
| 624 | XDrawLine(gi.disp, gi.pmap, gi.gc, x1+1, y1+1, x2+1, y2+1); |
| 625 | XDrawPoint(gi.disp, gi.pmap, gi.gc, x2+1, y2); |
| 626 | XDrawPoint(gi.disp, gi.pmap, gi.gc, x2, y2+1); |
| 627 | XDrawPoint(gi.disp, gi.pmap, gi.gc, x2+1, y2+1); |
| 628 | } |
| 629 | #endif |
| 630 | #ifdef WINANY |
| 631 | if (x1 == x2 && y1 == y2) { |
| 632 | DrawPoint(x1, y1); |
| 633 | return; |
| 634 | } |
| 635 | MoveTo(wi.hdc, x1, y1); |
| 636 | LineTo(wi.hdc, x2, y2); |
| 637 | if (wi.nScaleWin > 1) |
| 638 | return; |
| 639 | if (!gs.fThick) { |
| 640 | // For Windows lines, have to manually draw the last pixel. |
| 641 | SetPixel(wi.hdc, x2, y2, (COLORREF)gi.kvCur); |
| 642 | } else { |
| 643 | // Make the line thicker by drawing it four times. |
| 644 | i = gi.nScaleT; |
| 645 | LineTo(wi.hdc, x2+i, y2); |
| 646 | LineTo(wi.hdc, x1+i, y1); |
| 647 | LineTo(wi.hdc, x1, y1+i); |
| 648 | LineTo(wi.hdc, x2, y2+i); |
| 649 | LineTo(wi.hdc, x2+i, y2+i); |
| 650 | LineTo(wi.hdc, x1+i, y1+i); |
| 651 | LineTo(wi.hdc, x1, y1); |
| 652 | } |
| 653 | #endif |
| 654 | return; |
| 655 | } |
| 656 | #ifdef WIN |
| 657 | if (skip && wi.nScaleWin > 1) |
| 658 | skip = (skip + 2)*wi.nScaleWin + gs.nThickAdjust - 1; |
| 659 | #endif |
| 660 | } |
no test coverage detected