Closed jgranick closed 10 years ago
As I have already stated over a month ago, Assets.getBitmapData was broken, and remains broken. Even if "useCache" parameter is set to "false", you will still get the same BitmapData. And since OpenFL-bitfive follows principle of one BitmapData per Bitmap (to avoid sync and overhead issues), this efficiently means that user will have to manually clone most BitmapData's after retrieval if they want to use them in DOM. Here's a simplistic example: https://gist.github.com/YellowAfterlife/6bbd3f7df2ccf39ed66e
I am currently working on improving on current version of Assets class, similar to doing so with previous one. Will either keep it here or make pull requests to original, depending on compatibility.
Assets.getBitmapData was broken, and remains broken.
Can you link to the issue you created for this "broken"ness? Would be helpful to keep track of such things.
Yes, I think this was caused by the way assets were preloaded. If there are features in the browser that support fast duplication of the same asset, then I think it absolutely should follow the API, of either returning a cached copy or a new copy, similar to other targets. I have a feeling that your feelings on how it can be improved are probably shared. Since we can go as far as #if openfl_bitfive conditionals in the class (though I'm not sure it would have to go that far) I see no reason why openfl.Assets could not be in one place.
Can you link to the issue you created for this "broken"ness? Would be helpful to keep track of such things.
I've originally notified Joshua of this in HaxeFlixel conference. After not seeing any activity on the matter for some time, and since the problem primarily applies to openfl-bitfive
(openfl-html5-dom
is using a different scheme for displaying Bitmap objects so is relatively unaffected), I've introduced a local fix, https://github.com/YellowAfterlife/openfl-bitfive/commit/4634c9f3686177b94bebb1f676b38803d372bd52.
I am now in process of getting my fixes and improvements over to original branches. Already submitted the first. Merging this pull request, since I'll be sending in a commit that adds in a modification of current version of Assets class, which will be removed once my fixes get submitted and merged (thus removal would not degrade functionality).
openfl-bitfive appears to work properly using the current version of openfl.Assets, it is best if backends do not override this class. I have also removed the unneeded nme.AssetData class :)
If there are any improvements that are necessary (for one reason or anoher) within Assets, let us know and we can make the needed changes in the
openfl
repository, thanks!