quadToCubic method

void quadToCubic()

Converts every quadratic bezier to a cubic one

Implementation

void quadToCubic() {
  if (hasCompactCurves) {
    throw UnsupportedError('Outline mustn\'t contain compact curves');
  }

  if (!hasQuadCurves) {
    return;
  }

  // Starting with 1, because first point can't be a CP
  for (var i = 1; i < pointList.length; i++) {
    if (isOnCurveList[i]) {
      continue;
    }

    final qp0 = pointList[i - 1];
    final qp1 = pointList[i];
    final qp2 = i + 1 < pointList.length ? pointList[i + 1] : pointList.first;

    pointList.replaceRange(i, i + 1, quadCurveToCubic(qp0, qp1, qp2));
    isOnCurveList.insert(i, false);
    i++;
  }

  _hasQuadCurves = false;
}