code: function scanSpans(e0, e1, ymin, ymax, scanLine) {
    var y0 = Math.max(ymin, Math.floor(e1.y0)),
        y1 = Math.min(ymax, Math.ceil(e1.y1));
  
    // sort edges by x-coordinate
    if ((e0.x0 == e1.x0 && e0.y0 == e1.y0)
        ? (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1)
        : (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) {
      var t = e0; e0 = e1; e1 = t;
    }
  
    // scan lines!
    var m0 = e0.dx / e0.dy,
        m1 = e1.dx / e1.dy,
        d0 = e0.dx > 0, // use y + 1 to compute x0
        d1 = e1.dx < 0; // use y + 1 to compute x1
    for (var y = y0; y < y1; y++) {
      var x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0,
          x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0;
      scanLine(Math.floor(x1), Math.ceil(x0), y);
    }
  }
docs: scan-line conversion