drawParticles method

void drawParticles(
  1. Canvas canvas
)

Draws the current set of particles.

Uses shader rendering if enabled and available, otherwise falls back to Canvas.drawRawAtlas for optimal batched rendering.

Implementation

void drawParticles(Canvas canvas) {
  // If particle updates aren't running, skip drawing
  if (_particleCtrl.status.isDismissed) return;
  // Fallback? (or main draw now)
  // Create context
  final context = SpoilerContext(
    isFading: isFading,
    fadeRadius: _fadeRadius,
    fadeCenter: _fadeCenter,
    spoilerBounds: _spoilerBounds,
    spoilerRects: _spoilerRects,
    config: _config,
  );
  try {
    _drawer.draw(canvas, context);
  } catch (error, stackTrace) {
    if (_drawer is! AtlasSpoilerDrawer) {
      rethrow;
    }

    final fallbackDrawer = _downgradeAtlasDrawer(
      error,
      stackTrace,
    );
    fallbackDrawer.draw(canvas, context);
  }
}