picture
picture copied to clipboard
fix memory leak
When the parent element and the child element use the same blendFilter, the backdrop in the blendFilter will be overwritten. The overwritten backdrop cannot be recycled by the RenderTexturePool
, resulting in leakage.
The following is a simple example that reproduces the problem.
import * as PIXI from 'pixi.js';
import {Sprite, getBlendFilterArray} from '@pixi/picture';
// hacked sprite or tilingSprite
const sprite = new Sprite();
sprite.blendMode = PIXI.BLEND_MODES.OVERLAY;
// container with same filter
const container = new PIXI.Container();
container.filters = getBlendFilterArray(PIXI.BLEND_MODES.OVERLAY);
// add sprite as container's child
container.addChild(sprite);