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

Works on Android #2

Open
ashes999 opened this issue Dec 15, 2014 · 7 comments
Open

Works on Android #2

ashes999 opened this issue Dec 15, 2014 · 7 comments

Comments

@ashes999
Copy link

I tried loading a 640x346 gif (38 frames) on my Android device. Runs and displays quite well. I would send a pull request for the README.md, but I'm not sure what else needs to be done (eg. you have to make a platform-specific test txt file).

Also, I see around ten copies of this error message when I build for Android:

SVGData.hx:117: Warning, unknown transform:translate(5.7143)

However, it does run and display quite beautifully on my (low-end) phone.

Thanks for such a great library!

@Yanrishatum
Copy link
Owner

Actually, GifPlayer not optimized to use on mobile platforms, because it uses BitmapData.setPixels/fillRect/copyPixels methods when renders next frame. For better speed you may need to use GifRenderer and render entire gif to spritemap, and then use it for Tilesheet (but it's more expensive in memory usage).

The test txt files are just comparation between haxe-gif library and speed test, how fast image will take to process.

I don't know why this warning appears, I think it's from OpenFL's BitmapData implementation or something like that. I'm not have an Android device, so can't test it. (Yep, cave man, using typical old mobile phone)

@ashes999
Copy link
Author

The other issue I noticed is what appears to be a memory leak: if I keep switching back and forth between two FlxStates (HaxeFlixel), the animation starts getting choppier and choppier and choppier.

Rendering to a spritesheet won't work. In my case, my image is large enough (640x346) that I can't fit more than a couple of images in without running over the texture size limit (1024x1024 is the smallest) -- which is why I turned to animated GIFs instead of spritesheets.

Overall, I'm quite happy with the results.

Is it possible to scale the playback up or down? I use HaxeFlixel, so the rest of my game scales nicely to my device screen.

@Yanrishatum
Copy link
Owner

Hm. Maybe it's because of rendering issues. As said in GifPlayer description - it's a fast and dirty implementation. It's may be an error in GifPlayerWrapper, which assumes, that ENTER_FRAME event will be sent even if DisplayObject not added to display list. (behaviour of Flash)

If you use GifPlayerWrapper, you simply can use scaleX/scaleY. If you have your own wrapper to GifPlayer, you probably need to scale it yourself as you need it to be scaled. (GifPlayer only provides a BitmapData, displaying it is a work of wrapper)

@Yanrishatum
Copy link
Owner

The other issue I noticed is what appears to be a memory leak: if I keep switching back and forth between two FlxStates (HaxeFlixel), the animation starts getting choppier and choppier and choppier

Can you check it with last version? It's probably fixed.

@ashes999
Copy link
Author

I checked the latest version, and I can still reproduce the leak.

It may be my imagination, but I think it's degrading more slowly now than before.

@Yanrishatum
Copy link
Owner

The only reason I can imagine - bugged disposing of BitmapData. When frame uses Dispose Method: Restore Previous, new BitmapData will be created to be used when frame will be disposed, but I call dispose() method right after disposing frame. You can modify it, to store this BitmapData's, and generate them only once, and reuse them in future.

@ashes999
Copy link
Author

Sorry, I'm not following.

Thanks for trying to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants