Closed vince-styling closed 1 year ago
I think you are right, seems like a useless optimization in this day and age
Reopening it, I have not yet updated to only use 8888
I decided to keep the transparency check, but to cache it, so it's only calculated the first time each frame is decoded.
Actually, changed my mind 😂 , I'll simplify to ARGB_8888, this way I can also use a direct copyPixelsFromBuffer
method, slightly more optimized.
pay a test about time consuming of copyPixelsFromBuffer and setPixels, on android-11 there is no obvious difference, but setPixels faster over 4 times on android-13(0.515ms vs 2.102ms)
That seems counter intuitive, I'll have to bench that too 🤔
perhaps I was wrong, because I haven't much devices, my test may less accurate, don't bench before you confirm it
I added a bench to compare both, and copyPixels is always faster. It makes only a really little difference though, as the biggest part of creating a frame is decoding, not copying the result in a bitmap.
should we default the ARGB_8888 to wield space for time? especially I give up your BitmapCache, instead used only one bitmap instance through the whole decode procedure, I will explain in another issue