| 88 | #endif |
| 89 | |
| 90 | int Scanline::moveTo(double x) const { |
| 91 | if (intersections.empty()) |
| 92 | return -1; |
| 93 | int index = lastIndex; |
| 94 | if (x < intersections[index].x) { |
| 95 | do { |
| 96 | if (index == 0) { |
| 97 | lastIndex = 0; |
| 98 | return -1; |
| 99 | } |
| 100 | --index; |
| 101 | } while (x < intersections[index].x); |
| 102 | } else { |
| 103 | while (index < (int) intersections.size()-1 && x >= intersections[index+1].x) |
| 104 | ++index; |
| 105 | } |
| 106 | lastIndex = index; |
| 107 | return index; |
| 108 | } |
| 109 | |
| 110 | int Scanline::countIntersections(double x) const { |
| 111 | return moveTo(x)+1; |
no test coverage detected