mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
BaseTexture.destroy wasn't correctly removing the texture from the BaseTextureCache if it was a cached CanvasPool entry (such as Text objects use), causing drawImage errors in Canvas mode, and just blank textures in WebGL (thanks @civet #2339)
This commit is contained in:
parent
46cc05a377
commit
17071b578c
3 changed files with 12 additions and 2 deletions
|
@ -323,6 +323,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
|||
### Bug Fixes
|
||||
|
||||
* Groups now check for `child.parent` before calling `removeFromHash` (thanks @spayton #2323 #2338)
|
||||
* BaseTexture.destroy wasn't correctly removing the texture from the BaseTextureCache if it was a cached CanvasPool entry (such as Text objects use), causing drawImage errors in Canvas mode, and just blank textures in WebGL (thanks @civet #2339)
|
||||
|
||||
### Pixi Updates
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
/**
|
||||
* A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
|
||||
* A single BitmapData can be used as the texture for one or many Images/Sprites.
|
||||
* A single BitmapData can be used as the texture for one or many Images / Sprites.
|
||||
* So if you need to dynamically create a Sprite texture then they are a good choice.
|
||||
*
|
||||
* Important note: Every BitmapData creates its own Canvas element. Because BitmapData's are now Game Objects themselves, and don't
|
||||
* live on the display list, they are NOT automatically cleared when you change State. Therefore you _must_ call BitmapData.destroy
|
||||
* in your State's shutdown method if you wish to free-up the resources the BitmapData used, it will not happen for you.
|
||||
*
|
||||
* @class Phaser.BitmapData
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
|
@ -1853,6 +1857,8 @@ Phaser.BitmapData.prototype = {
|
|||
*/
|
||||
destroy: function () {
|
||||
|
||||
this.texture.destroy(true);
|
||||
|
||||
PIXI.CanvasPool.remove(this);
|
||||
|
||||
},
|
||||
|
|
|
@ -184,7 +184,10 @@ PIXI.BaseTexture.prototype.destroy = function()
|
|||
{
|
||||
PIXI.CanvasPool.removeByCanvas(this.source);
|
||||
|
||||
delete PIXI.BaseTextureCache[this.source];
|
||||
if (this.source._pixiId)
|
||||
{
|
||||
delete PIXI.BaseTextureCache[this.source._pixiId];
|
||||
}
|
||||
}
|
||||
|
||||
this.source = null;
|
||||
|
|
Loading…
Reference in a new issue