reload method

  1. @override
SpriteImage reload()
override

Re-resolves this sprite against Ignis.cache.

Returns this unless what it was built from has since been replaced, so the caller can tell whether anything changed by identity.

Implementation

@override
SpriteImage reload() {
  // Art evicted rather than replaced keeps whatever it last cut.
  if (!region.isLoaded) return this;
  if (identical(region.image, entries.single.image)) return this;

  // A replacement image this region no longer fits keeps the last cut.
  // TODO: Evaluate if this is intuitive or not after a few games.
  if (!region.fits) return this;

  return SpriteImage.of(region);
}