applyCache method

void applyCache(
  1. num x,
  2. num y,
  3. num width,
  4. num height,
  5. {bool debugBorder = false,
  6. num pixelRatio = 1.0}

Draws the specified area of this display object to an internal render texture and the engine will use this texture to optimize performance.

This is useful when the display object contains many static children or a Graphics vector object. If the cached area changes, the cache must be refreshed using refreshCache or removed using removeCache.


void applyCache(num x, num y, num width, num height,
    {bool debugBorder = false, num pixelRatio = 1.0}) {
  _cache ??= _DisplayObjectCache(this);
  _cache.debugBorder = debugBorder;
  _cache.pixelRatio = pixelRatio;
  _cache.bounds = Rectangle<num>(x, y, width, height);