Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateTexture()
{
const canvas = this.canvas;
if (this._style.trim)
{
const trimmed = trimCanvas(canvas);
canvas.width = trimmed.width;
canvas.height = trimmed.height;
this.context.putImageData(trimmed.data, 0, 0);
}
const texture = this._texture;
const style = this._style;
const padding = style.trim ? 0 : style.padding;
const baseTexture = texture.baseTexture;
texture.trim.width = texture._frame.width = canvas.width / this.resolution;
texture.trim.height = texture._frame.height = canvas.height / this.resolution;
texture.trim.x = -padding;
texture.trim.y = -padding;
updateTexture()
{
const canvas = this.canvas;
if (this._style.trim)
{
const trimmed = trimCanvas(canvas);
if (trimmed.data)
{
canvas.width = trimmed.width;
canvas.height = trimmed.height;
this.context.putImageData(trimmed.data, 0, 0);
}
}
const texture = this._texture;
const style = this._style;
const padding = style.trim ? 0 : style.padding;
const baseTexture = texture.baseTexture;
texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);
texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);