I've done my profiling and it seems that most of my time is spent during drawBitmap, which is called (understandingly) on every frame.
I use SurfaceView/updating thread/canvas locking approach as demonstrated in LunarLander sample. But I've changed it (according to this question) as to
Traceview showed me that this drawBitmap takes 5ms for each frame on my 800x480 device. Can I get any better than that or is it just something that is 'carved into the stone' and I just have to optimize other parts of the code to achieve good frames per second?
It depends on many things, but usually drawBitmap() will be as fast as it can get. In your particular case, if you don't need blending, make sure your are using an opaque bitmap. In addition, try to use a Bitmap in a format compatible with your Surface. For instance, if you are using a 16 bits Surface, drawing a 16-bits (RGB565) bitmap will be very fast (it's just a memcpy call.) If your Surface is 32 bits, use an ARGB8888 opaque Bitmap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With