Adds any edges from a single segment of outline between pt1 and pt2 to the x_coords, y_coords vectors. pt1 and pt2 should be relative to the bottom-left of the bounding box, hence indices to x_coords, y_coords are clipped to ([0,x_limit], [0,y_limit]). See GetEdgeCoords above for a description of x_coords, y_coords.
| 611 | // are clipped to ([0,x_limit], [0,y_limit]). |
| 612 | // See GetEdgeCoords above for a description of x_coords, y_coords. |
| 613 | static void SegmentCoords(const FCOORD& pt1, const FCOORD& pt2, |
| 614 | int x_limit, int y_limit, |
| 615 | GenericVector<GenericVector<int> >* x_coords, |
| 616 | GenericVector<GenericVector<int> >* y_coords) { |
| 617 | FCOORD step(pt2); |
| 618 | step -= pt1; |
| 619 | int start = ClipToRange(IntCastRounded(MIN(pt1.x(), pt2.x())), 0, x_limit); |
| 620 | int end = ClipToRange(IntCastRounded(MAX(pt1.x(), pt2.x())), 0, x_limit); |
| 621 | for (int x = start; x < end; ++x) { |
| 622 | int y = IntCastRounded(pt1.y() + step.y() * (x + 0.5 - pt1.x()) / step.x()); |
| 623 | (*y_coords)[x].push_back(y); |
| 624 | } |
| 625 | start = ClipToRange(IntCastRounded(MIN(pt1.y(), pt2.y())), 0, y_limit); |
| 626 | end = ClipToRange(IntCastRounded(MAX(pt1.y(), pt2.y())), 0, y_limit); |
| 627 | for (int y = start; y < end; ++y) { |
| 628 | int x = IntCastRounded(pt1.x() + step.x() * (y + 0.5 - pt1.y()) / step.y()); |
| 629 | (*x_coords)[y].push_back(x); |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | // Adds any edges from a single segment of outline between pt1 and pt2 to |
| 634 | // the bbox such that it guarantees to contain anything produced by |
no test coverage detected