Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up BaseTexture Destroy #415

Merged
merged 1 commit into from
Dec 8, 2013
Merged

Conversation

mattdesl
Copy link
Contributor

Just noticed that we are now removing the Image reference from the base texture cache on destroy. This is good (we use this in our own fork, and it caused a big boost on mobile performance). But in my testing I've noticed that the "src" attribute of Image will not always return the exact string you set it earlier. For example, it may get appended with the domain (i.e. "http://localhost/"). This leads to a problem where the BaseTexture is still not deleted correctly.

This pull request adds three things:

  • It fixes this issue by storing the imageURL string for later deletion.
  • It does not call drawImage if the baseTexture's source is null.
  • It adds removeAllEventListeners to EventTarget. This was useful in our game where we are loading and unloading textures on the fly, and relying on AssetLoader's "onComplete" event.

We are not unloading textures when WebGL is active, so that path may need some further testing.

P.S. What is with "dev_simple_batch" branch? Is this the new dev branch going forward?

@mattdesl
Copy link
Contributor Author

mattdesl commented Dec 5, 2013

Another issue just cropped up in our game regarding deleting base textures and sprite sheets. It was causing images not to be re-loaded.

When a sprite sheet is loaded, it gets added to the TextureCache. This happens when onJSONLoaded creates a new ImageLoader. So BaseTexture.destroy() should really be deleting the entry from the TextureCache, as well as BaseTextureGame.

@englercj
Copy link
Member

englercj commented Dec 8, 2013

Looks good to me! Thanks!

englercj added a commit that referenced this pull request Dec 8, 2013
Cleaning up BaseTexture Destroy
@englercj englercj merged commit d854f5c into pixijs:dev Dec 8, 2013
@lock
Copy link

lock bot commented Feb 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants