validate method

void validate()

Validate movie-level metadata. Short sprite timelines are allowed and skipped after their last frame by the renderer.

Implementation

void validate() {
  final p = params;
  if (!hasParams() ||
      !p.viewBoxWidth.isFinite ||
      !p.viewBoxHeight.isFinite ||
      p.viewBoxWidth <= 0 ||
      p.viewBoxHeight <= 0 ||
      p.frames < 1 ||
      p.frames > 100000 ||
      p.fps < 0 ||
      p.fps > 1000 ||
      sprites.length > 10000) {
    throw const FormatException('Invalid SVGA movie parameters');
  }
  var frameCount = 0;
  for (final sprite in sprites) {
    frameCount += sprite.frames.length;
    if (frameCount > 1000000) {
      throw const FormatException('Too many SVGA frames');
    }
  }
}