pointsRequiredForVerbs function
Floats consumed by verbs (move/line = 1 point, quad = 2, cubic = 3,
close = 0; two floats per point). Unknown verb bytes report -1 so a
caller comparing against an actual points length fails closed.
Implementation
int pointsRequiredForVerbs(Uint8List verbs) {
var floats = 0;
for (final verb in verbs) {
switch (verb) {
case 0: // move
case 1: // line
floats += 2;
break;
case 2: // quad
floats += 4;
break;
case 4: // cubic
floats += 6;
break;
case 5: // close
break;
default:
return -1;
}
}
return floats;
}