diff --git a/src/core/renderers/canvas/utils/CanvasRenderTarget.js b/src/core/renderers/canvas/utils/CanvasRenderTarget.js index 5030080..a30c35b 100644 --- a/src/core/renderers/canvas/utils/CanvasRenderTarget.js +++ b/src/core/renderers/canvas/utils/CanvasRenderTarget.js @@ -1,3 +1,5 @@ +var CONST = require('../../../const'); + /** * Creates a Canvas element of the given size. * @@ -22,7 +24,7 @@ */ this.context = this.canvas.getContext('2d'); - this.resolution = resolution; + this.resolution = resolution || CONST.RESOLUTION; this.resize(width, height); } diff --git a/src/core/renderers/canvas/utils/CanvasRenderTarget.js b/src/core/renderers/canvas/utils/CanvasRenderTarget.js index 5030080..a30c35b 100644 --- a/src/core/renderers/canvas/utils/CanvasRenderTarget.js +++ b/src/core/renderers/canvas/utils/CanvasRenderTarget.js @@ -1,3 +1,5 @@ +var CONST = require('../../../const'); + /** * Creates a Canvas element of the given size. * @@ -22,7 +24,7 @@ */ this.context = this.canvas.getContext('2d'); - this.resolution = resolution; + this.resolution = resolution || CONST.RESOLUTION; this.resize(width, height); } diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index f6b098b..1756381 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -146,29 +146,14 @@ glData.quad.initVao(glData.shader); } - var w0, w1, h0, h1, - crop = texture.crop; - // if the sprite is trimmed and is not a tilingsprite then we need to add the extra space before transforming the sprite coords.. - w0 = ( this._width ) * (1-this.anchor.x); - w1 = ( this._width ) * -this.anchor.x; - - h0 = this._height * (1-this.anchor.y); - h1 = this._height * -this.anchor.y; - var vertices = glData.quad.vertices; - - vertices[0] = w1 - vertices[1] = h1 - vertices[2] = w0 - vertices[3] = h1 + vertices[0] = vertices[6] = ( this._width ) * -this.anchor.x; + vertices[1] = vertices[3] = this._height * -this.anchor.y; - vertices[4] = w0 - vertices[5] = h0 - - vertices[6] = w1 - vertices[7] = h0 + vertices[2] = vertices[4] = ( this._width ) * (1-this.anchor.x); + vertices[5] = vertices[7] = this._height * (1-this.anchor.y); glData.quad.upload(); @@ -233,7 +218,7 @@ if(!this._canvasPattern) { // cut an object from a spritesheet.. - var tempCanvas = new core.CanvasBuffer(texture._frame.width, texture._frame.height); + var tempCanvas = new core.CanvasRenderTarget(texture._frame.width, texture._frame.height); // Tint the tiling sprite if (this.tint !== 0xFFFFFF)