78 lines
3.2 KiB
JavaScript
78 lines
3.2 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem = function(global, require, module, exports) {
|
|
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
|
|
var InstructionSet = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$instructions$InstructionSet"), GCManagedHash = require("module$node_modules$pixi_DOT_js$lib$utils$data$GCManagedHash");
|
|
"use strict";
|
|
class CanvasGraphicsContext {
|
|
constructor() {
|
|
this.isBatchable = !1;
|
|
}
|
|
reset() {
|
|
this.isBatchable = !1;
|
|
this.context = null;
|
|
this.graphicsData && (this.graphicsData.destroy(), this.graphicsData = null);
|
|
}
|
|
destroy() {
|
|
this.reset();
|
|
}
|
|
}
|
|
class CanvasGraphicsContextRenderData {
|
|
constructor() {
|
|
this.instructions = new InstructionSet.InstructionSet();
|
|
}
|
|
init() {
|
|
this.instructions.reset();
|
|
}
|
|
destroy() {
|
|
this.instructions.destroy();
|
|
this.instructions = null;
|
|
}
|
|
}
|
|
const node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem$classdecl$var32 = class {
|
|
constructor(renderer) {
|
|
this._renderer = renderer;
|
|
this._managedContexts = new GCManagedHash.GCManagedHash({renderer, type:"resource", name:"graphicsContext"});
|
|
}
|
|
init(options) {
|
|
node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem$classdecl$var32.defaultOptions.bezierSmoothness = options?.bezierSmoothness ?? node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem$classdecl$var32.defaultOptions.bezierSmoothness;
|
|
}
|
|
getContextRenderData(context) {
|
|
return this.getGpuContext(context).graphicsData || this._initContextRenderData(context);
|
|
}
|
|
updateGpuContext(context) {
|
|
var gpuData = context._gpuData;
|
|
const hasContext = !!gpuData[this._renderer.uid];
|
|
gpuData = gpuData[this._renderer.uid] || this._initContext(context);
|
|
if (context.dirty || !hasContext) {
|
|
hasContext && gpuData.reset(), gpuData.isBatchable = !1, context.dirty = !1;
|
|
}
|
|
return gpuData;
|
|
}
|
|
getGpuContext(context) {
|
|
return context._gpuData[this._renderer.uid] || this._initContext(context);
|
|
}
|
|
_initContextRenderData(context) {
|
|
const renderData = new CanvasGraphicsContextRenderData();
|
|
this.getGpuContext(context).graphicsData = renderData;
|
|
renderData.init();
|
|
return renderData;
|
|
}
|
|
_initContext(context) {
|
|
const gpuContext = new CanvasGraphicsContext();
|
|
gpuContext.context = context;
|
|
context._gpuData[this._renderer.uid] = gpuContext;
|
|
this._managedContexts.add(context);
|
|
return gpuContext;
|
|
}
|
|
destroy() {
|
|
this._managedContexts.destroy();
|
|
this._renderer = null;
|
|
}
|
|
};
|
|
require = node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem$classdecl$var32;
|
|
require.extension = {type:[global.ExtensionType.CanvasSystem], name:"graphicsContext"};
|
|
require.defaultOptions = {bezierSmoothness:0.5};
|
|
exports.CanvasGraphicsContextSystem = require;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$canvas$CanvasGraphicsContextSystem.js.map
|