fillPolyline function

void fillPolyline(
  1. Path path,
  2. List<Float64List> subs,
  3. List<bool> closed
)

Refills path with the sampled subpaths — the in-flight shape.

path is reset rather than reallocated: the controller keeps one Path for the lifetime of the animation, so a frame allocates nothing here.

Implementation

void fillPolyline(ui.Path path, List<Float64List> subs, List<bool> closed) {
  path.reset();
  for (var k = 0; k < subs.length; k++) {
    final o = subs[k];
    final n = o.length ~/ 2;
    if (n == 0) continue;
    path.moveTo(o[0], o[1]);
    for (var i = 1; i < n; i++) {
      path.lineTo(o[2 * i], o[2 * i + 1]);
    }
    if (k < closed.length && closed[k]) path.close();
  }
}