1 | {"version":3,"file":"AbstractMaskSystem.js","sources":["../../src/mask/AbstractMaskSystem.ts"],"sourcesContent":["import type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array<MaskData>;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array<MaskData>): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n"],"names":[],"mappings":";AAQO,MAAM,mBACb;AAAA;AAAA;AAAA;AAAA,EAiBI,YAAY,UACZ;AACI,SAAK,WAAW,UAEhB,KAAK,YAAY,IACjB,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA,EAGA,iBACA;AACI,WAAO,KAAK,UAAU;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,WACb;AACI,UAAM,EAAE,GAAG,IAAI,KAAK,UACd,cAAc,KAAK;AAEzB,SAAK,YAAY;AAEX,UAAA,cAAc,KAAK;AAErB,oBAAgB,gBAEZ,gBAAgB,IAEhB,GAAG,QAAQ,KAAK,OAAO,KAIvB,GAAG,OAAO,KAAK,OAAO,GACtB,KAAK,YAAY;AAAA,EAG7B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMU,cACV;AAAA,EAEA;AAAA;AAAA,EAGA,UACA;AACS,SAAA,WAAW,MAChB,KAAK,YAAY;AAAA,EACrB;AACJ;;"} |