srecord noeq FillOnePath(OnePathWithOrigin path) { Rect r; // bounds BitSet bits; run { bounds = path.bounds(); bits = new BitSet(r.w*r.h); Pt last = null; for (Pt p : path.pointIterator()) { int idx = (p.x-r.x)+(p.y-r.y)*r.w; if (last != null && p.y == last.y) { // two consecutive points on same row: special handling int diff = p.x == last.x; if (diff == 0) {} // same point? do nothing else if (diff < 0) {} // going left? else } else // points not on same row - just mark the point bits.flip(idx); last = p; } } }