I am using SurfaceView for my game and I am loading all of the bitmaps that are the right size for the screen (pre-scaled in mipmap folder) into a class when the game starts. And I am drawing the bitmaps to the canvas using the drawBitmap method.
Though all of the bitmaps are compressed in 8 bit PNG format and scaled for the screen size, I am getting an awful FPS rate (around 40 FPS)
Things I have tried:
Made sure drawBitmap is the cause of the issue by recording the performance via performance monitor and examining the results. Basically, that is the only method that is causing an overhead.
Trimmed all of the transparent bits that are on the sides and used the fill canvas method for the background.
Scaled and compressed the bitmaps properly
Made sure nothing above or below the screen gets rendered
So this left me wondering; is a modern phone equipped with who knows how many times more powerful CPU and GPU than the computers in the early 2000s unable to utilize its hardware and thus unable to perform such a simple rendering request that those computers that are 2 decades old managed to do? I know drawBitmap uses CPU but nonetheless…
I am only drawing a bitmap that is 1/3 of the size of the screen and 2-3 small bitmaps on top of it (1/6 of the screen size) seeing as low as 30 FPS in such a simple task after all those optimizations is simply disappointing. Migrating to OpenGL will break so many parts of the code and obviously will be more challenging. And as far as I know, there isn’t a library that simplifies drawing bitmaps by handling the OpenGL side and only exposes the canvas-like API.
So is there anything else I can do to increase the performance?