Prismalpha.8
Runtime

Invalidation

Tell Prism when app-owned data or surface state needs another paint pass.

Prism owns the paint lifecycle, but your app owns the state that changes what should be drawn.

Invalidation schedules paint; it is not app state management.

Prism invalidates automatically when a surface is registered or unregistered, when onPaint() registers a paint handler, and when surface.setBounds() changes bounds outside an active paint pass.

Call runtime.invalidate() when app-owned state changes and Prism would not otherwise know that another paint pass is needed.

Call the invalidation API from paint handlers when another runtime-owned pass is needed:

runtime.onPaint(({ drawSurface, invalidate }) => {
  drawSurface(surface);

  if (animationStillRunning) {
    invalidate();
  }
});

Keep app state outside Prism. Use invalidation to schedule painting, not to store application data.