Fixed lint errors with PR #5193

This commit is contained in:
Richard Davey 2020-07-13 12:55:49 +01:00
parent 259b702df8
commit 6374da052f
2 changed files with 31 additions and 28 deletions

View file

@ -30,7 +30,7 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
} }
var transformMatrix = container.localTransform; var transformMatrix = container.localTransform;
if (parentMatrix) if (parentMatrix)
{ {
transformMatrix.loadIdentity(); transformMatrix.loadIdentity();
@ -55,11 +55,12 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
var alpha = container._alpha; var alpha = container._alpha;
var scrollFactorX = container.scrollFactorX; var scrollFactorX = container.scrollFactorX;
var scrollFactorY = container.scrollFactorY; var scrollFactorY = container.scrollFactorY;
if (container.mask) { if (container.mask)
{
container.mask.preRenderCanvas(renderer, null, camera); container.mask.preRenderCanvas(renderer, null, camera);
} }
for (var i = 0; i < children.length; i++) for (var i = 0; i < children.length; i++)
{ {
var child = children[i]; var child = children[i];
@ -90,11 +91,11 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
child.setAlpha(childAlpha); child.setAlpha(childAlpha);
child.setScrollFactor(childScrollFactorX, childScrollFactorY); child.setScrollFactor(childScrollFactorX, childScrollFactorY);
} }
if (container.mask) { if (container.mask)
{
container.mask.postRenderCanvas(renderer); container.mask.postRenderCanvas(renderer);
} }
}; };
module.exports = ContainerCanvasRenderer; module.exports = ContainerCanvasRenderer;

View file

@ -145,7 +145,7 @@ var CanvasRenderer = new Class({
/** /**
* Details about the currently scheduled snapshot. * Details about the currently scheduled snapshot.
* *
* If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered.
* *
* @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState
@ -489,9 +489,9 @@ var CanvasRenderer = new Class({
/** /**
* Takes a snapshot of the given area of the given canvas. * Takes a snapshot of the given area of the given canvas.
* *
* Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render. * Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render.
* *
* Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets
* more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * more expensive the larger the canvas size gets, so please be careful how you employ this in your game.
* *
@ -529,12 +529,12 @@ var CanvasRenderer = new Class({
/** /**
* Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered.
* *
* To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`.
* *
* Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then
* calling this method will override it. * calling this method will override it.
* *
* Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets
* more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * more expensive the larger the canvas size gets, so please be careful how you employ this in your game.
* *
@ -554,12 +554,12 @@ var CanvasRenderer = new Class({
/** /**
* Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered.
* *
* To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`.
* *
* Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then
* calling this method will override it. * calling this method will override it.
* *
* Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets
* more expensive the larger the canvas size gets, so please be careful how you employ this in your game. * more expensive the larger the canvas size gets, so please be careful how you employ this in your game.
* *
@ -594,12 +594,12 @@ var CanvasRenderer = new Class({
/** /**
* Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered.
* *
* To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`.
* *
* Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then
* calling this method will override it. * calling this method will override it.
* *
* Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for
* the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute,
* using less memory. * using less memory.
@ -642,7 +642,7 @@ var CanvasRenderer = new Class({
// Nothing to see, so abort early // Nothing to see, so abort early
return; return;
} }
var ctx = this.currentContext; var ctx = this.currentContext;
var camMatrix = this._tempMatrix1; var camMatrix = this._tempMatrix1;
@ -676,7 +676,7 @@ var CanvasRenderer = new Class({
frameWidth = crop.cw; frameWidth = crop.cw;
frameHeight = crop.ch; frameHeight = crop.ch;
frameX = crop.cx; frameX = crop.cx;
frameY = crop.cy; frameY = crop.cy;
@ -694,7 +694,7 @@ var CanvasRenderer = new Class({
x = (Math.abs(x) - frameWidth); x = (Math.abs(x) - frameWidth);
} }
} }
if (sprite.flipY) if (sprite.flipY)
{ {
if (y >= 0) if (y >= 0)
@ -752,13 +752,13 @@ var CanvasRenderer = new Class({
{ {
spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX;
spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY;
// Multiply by the Sprite matrix, store result in calcMatrix // Multiply by the Sprite matrix, store result in calcMatrix
camMatrix.multiply(spriteMatrix, calcMatrix); camMatrix.multiply(spriteMatrix, calcMatrix);
} }
ctx.save(); ctx.save();
calcMatrix.setToContext(ctx); calcMatrix.setToContext(ctx);
ctx.globalCompositeOperation = this.blendModes[sprite.blendMode]; ctx.globalCompositeOperation = this.blendModes[sprite.blendMode];
@ -766,17 +766,19 @@ var CanvasRenderer = new Class({
ctx.globalAlpha = alpha; ctx.globalAlpha = alpha;
ctx.imageSmoothingEnabled = !(!this.antialias || frame.source.scaleMode); ctx.imageSmoothingEnabled = !(!this.antialias || frame.source.scaleMode);
if (sprite.mask) { if (sprite.mask)
{
sprite.mask.preRenderCanvas(this, sprite, camera); sprite.mask.preRenderCanvas(this, sprite, camera);
} }
ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res);
if (sprite.mask) { if (sprite.mask)
{
sprite.mask.postRenderCanvas(this, sprite, camera); sprite.mask.postRenderCanvas(this, sprite, camera);
} }
ctx.restore(); ctx.restore();
}, },