Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$getCanvasTexture.js
2026-07-01 22:38:29 -06:00

25 lines
1.3 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$getCanvasTexture = function(global, require, module, exports) {
global = require("module$node_modules$pixi_DOT_js$lib$utils$pool$GlobalResourceRegistry");
var CanvasSource = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$CanvasSource"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture");
"use strict";
const canvasCache = new Map();
global.GlobalResourceRegistry.register(canvasCache);
exports.getCanvasTexture = function(canvas, options) {
if (!canvasCache.has(canvas)) {
const texture = new Texture.Texture({source:new CanvasSource.CanvasSource({resource:canvas, ...options})});
options = () => {
canvasCache.get(canvas) === texture && canvasCache.delete(canvas);
};
texture.once("destroy", options);
texture.source.once("destroy", options);
canvasCache.set(canvas, texture);
}
return canvasCache.get(canvas);
};
exports.hasCachedCanvasTexture = function(canvas) {
return canvasCache.has(canvas);
};
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$getCanvasTexture.js.map