diff --git a/src/core/renderers/webgl/RenderTextureManager.js b/src/core/renderers/webgl/RenderTextureManager.js index a5b639b..cbbbd4c 100644 --- a/src/core/renderers/webgl/RenderTextureManager.js +++ b/src/core/renderers/webgl/RenderTextureManager.js @@ -58,7 +58,7 @@ RenderTextureManager.prototype.destroyTexture = function(texture, _skipRemove) { texture = texture.baseTexture || texture; - + var gl = this.gl; if (texture._glRenderTargets[gl.id]) { diff --git a/src/core/renderers/webgl/RenderTextureManager.js b/src/core/renderers/webgl/RenderTextureManager.js index a5b639b..cbbbd4c 100644 --- a/src/core/renderers/webgl/RenderTextureManager.js +++ b/src/core/renderers/webgl/RenderTextureManager.js @@ -58,7 +58,7 @@ RenderTextureManager.prototype.destroyTexture = function(texture, _skipRemove) { texture = texture.baseTexture || texture; - + var gl = this.gl; if (texture._glRenderTargets[gl.id]) { diff --git a/src/core/textures/BaseRenderTexture.js b/src/core/textures/BaseRenderTexture.js index 0174888..ed664d3 100644 --- a/src/core/textures/BaseRenderTexture.js +++ b/src/core/textures/BaseRenderTexture.js @@ -121,35 +121,13 @@ }; /** - * Clears the BaseRenderTexture. - * - */ -BaseRenderTexture.prototype.clear = function (destinationFrame) -{ - if (!this.valid) - { - return; - } - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - } - - this.textureBuffer.clear(false, destinationFrame); -}; - - -/** * Destroys this texture * * @param destroyBase {boolean} Whether to destroy the base texture as well */ BaseRenderTexture.prototype.destroy = function () { - Texture.prototype.destroy.call(this, true); - - this.textureBuffer.destroy(); + BaseTexture.prototype.destroy.call(this, true); // destroy the filtermanager.. if(this.filterManager) diff --git a/src/core/renderers/webgl/RenderTextureManager.js b/src/core/renderers/webgl/RenderTextureManager.js index a5b639b..cbbbd4c 100644 --- a/src/core/renderers/webgl/RenderTextureManager.js +++ b/src/core/renderers/webgl/RenderTextureManager.js @@ -58,7 +58,7 @@ RenderTextureManager.prototype.destroyTexture = function(texture, _skipRemove) { texture = texture.baseTexture || texture; - + var gl = this.gl; if (texture._glRenderTargets[gl.id]) { diff --git a/src/core/textures/BaseRenderTexture.js b/src/core/textures/BaseRenderTexture.js index 0174888..ed664d3 100644 --- a/src/core/textures/BaseRenderTexture.js +++ b/src/core/textures/BaseRenderTexture.js @@ -121,35 +121,13 @@ }; /** - * Clears the BaseRenderTexture. - * - */ -BaseRenderTexture.prototype.clear = function (destinationFrame) -{ - if (!this.valid) - { - return; - } - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - } - - this.textureBuffer.clear(false, destinationFrame); -}; - - -/** * Destroys this texture * * @param destroyBase {boolean} Whether to destroy the base texture as well */ BaseRenderTexture.prototype.destroy = function () { - Texture.prototype.destroy.call(this, true); - - this.textureBuffer.destroy(); + BaseTexture.prototype.destroy.call(this, true); // destroy the filtermanager.. if(this.filterManager) diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index e8ef618..67b03d7 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -99,72 +99,6 @@ this._updateUvs(); }; -/** - * Clears the RenderTexture. - * - */ -RenderTexture.prototype.clear = function () -{ - if (!this.valid) - { - return; - } - - this.baseTexture.clear(this.frame) - -}; - -/** - * Will return a HTML Image of the texture - * - * @return {Image} - */ -RenderTexture.prototype.getImage = function () -{ - return this.baseTexture.getImage(this.frame); -}; - -/** - * Will return a a base64 encoded string of this texture. It works by calling RenderTexture.getCanvas and then running toDataURL on that. - * - * @return {string} A base64 encoded string of the texture. - */ -RenderTexture.prototype.getBase64 = function () -{ - return this.getBase64.getImage(this.frame); -}; - -/** - * Creates a Canvas element, renders this RenderTexture to it and then returns it. - * - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ -RenderTexture.prototype.getCanvas = function () -{ - return this.baseTexture.getCanvas(this.frame); -}; - -/** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * - * @return {Uint8ClampedArray} - */ -RenderTexture.prototype.getPixels = function () -{ - return this.baseTexture.getPixels(this.frame); -}; - -/** - * Will return a one-dimensional array containing the pixel data of a pixel within the texture in RGBA order, with integer values between 0 and 255 (included). - * - * @param x {number} The x coordinate of the pixel to retrieve. - * @param y {number} The y coordinate of the pixel to retrieve. - * @return {Uint8ClampedArray} - */ -RenderTexture.prototype.getPixel = function (x, y) -{ - return this.baseTexture.getPixel(this.frame, x, y); -}; RenderTexture.create = function(width, height, scaleMode, resolution) { diff --git a/src/core/renderers/webgl/RenderTextureManager.js b/src/core/renderers/webgl/RenderTextureManager.js index a5b639b..cbbbd4c 100644 --- a/src/core/renderers/webgl/RenderTextureManager.js +++ b/src/core/renderers/webgl/RenderTextureManager.js @@ -58,7 +58,7 @@ RenderTextureManager.prototype.destroyTexture = function(texture, _skipRemove) { texture = texture.baseTexture || texture; - + var gl = this.gl; if (texture._glRenderTargets[gl.id]) { diff --git a/src/core/textures/BaseRenderTexture.js b/src/core/textures/BaseRenderTexture.js index 0174888..ed664d3 100644 --- a/src/core/textures/BaseRenderTexture.js +++ b/src/core/textures/BaseRenderTexture.js @@ -121,35 +121,13 @@ }; /** - * Clears the BaseRenderTexture. - * - */ -BaseRenderTexture.prototype.clear = function (destinationFrame) -{ - if (!this.valid) - { - return; - } - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - } - - this.textureBuffer.clear(false, destinationFrame); -}; - - -/** * Destroys this texture * * @param destroyBase {boolean} Whether to destroy the base texture as well */ BaseRenderTexture.prototype.destroy = function () { - Texture.prototype.destroy.call(this, true); - - this.textureBuffer.destroy(); + BaseTexture.prototype.destroy.call(this, true); // destroy the filtermanager.. if(this.filterManager) diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index e8ef618..67b03d7 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -99,72 +99,6 @@ this._updateUvs(); }; -/** - * Clears the RenderTexture. - * - */ -RenderTexture.prototype.clear = function () -{ - if (!this.valid) - { - return; - } - - this.baseTexture.clear(this.frame) - -}; - -/** - * Will return a HTML Image of the texture - * - * @return {Image} - */ -RenderTexture.prototype.getImage = function () -{ - return this.baseTexture.getImage(this.frame); -}; - -/** - * Will return a a base64 encoded string of this texture. It works by calling RenderTexture.getCanvas and then running toDataURL on that. - * - * @return {string} A base64 encoded string of the texture. - */ -RenderTexture.prototype.getBase64 = function () -{ - return this.getBase64.getImage(this.frame); -}; - -/** - * Creates a Canvas element, renders this RenderTexture to it and then returns it. - * - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ -RenderTexture.prototype.getCanvas = function () -{ - return this.baseTexture.getCanvas(this.frame); -}; - -/** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * - * @return {Uint8ClampedArray} - */ -RenderTexture.prototype.getPixels = function () -{ - return this.baseTexture.getPixels(this.frame); -}; - -/** - * Will return a one-dimensional array containing the pixel data of a pixel within the texture in RGBA order, with integer values between 0 and 255 (included). - * - * @param x {number} The x coordinate of the pixel to retrieve. - * @param y {number} The y coordinate of the pixel to retrieve. - * @return {Uint8ClampedArray} - */ -RenderTexture.prototype.getPixel = function (x, y) -{ - return this.baseTexture.getPixel(this.frame, x, y); -}; RenderTexture.create = function(width, height, scaleMode, resolution) { diff --git a/src/extras/cacheAsBitmap.js b/src/extras/cacheAsBitmap.js index 15b7877..82dc55c 100644 --- a/src/extras/cacheAsBitmap.js +++ b/src/extras/cacheAsBitmap.js @@ -260,7 +260,7 @@ */ DisplayObject.prototype._destroyCachedDisplayObject = function () { - this._cachedSprite._texture.destroy(); + this._cachedSprite._texture.destroy(true); this._cachedSprite = null; };