Closed PauGuillamon closed 3 years ago
Actually, that's a great question. Maybe we should make the shared input stream thread safe? As is, if two GIFs using the same descriptor would read data, I wonder what would happen. I'll take a look tomorrow.
For my use case I always call my Gif objects on the main thread, so that shouldn´t be a problem for me. I guess in a multi-threaded environment we could have a problem here, but same would apply for GifDrawable, right?
If you like this PR we could merge it and afterwards look into making it thread safe.
If you want I can release a point release tonight?
That will be awesome, thank you!
@PauGuillamon 0.7.3 released! Should be deployed in 10 minutes or so.
Adding a function to be able to clone a Gif. As I'm using Gif directly instead of GifDrawable, I was missing the possibility of being able to clone Gifs. With this I don't need to keep opening a file and creating new Gifs with a manually handled InputStream.
I was not sure if sharing the same InputStream between Gifs was safe or not, but I saw GifDrawable basically doing the same through GifDrawableState(). So I hope I didn't miss anything 😄
I tried keeping the same convention with a
Git.from()
function, but I am happy to change it in another way if you prefer.