天天看点

android drawbitmap模糊,user interface - Android drawBitmap(...) method is slow? - Stack Overflow

I'm programming an Android game using SurfaceView.

The canvas obtained by the SurfaceView draws an 32bit PNG image of size 80x80 with alpha layer. The time that the method drawBitmap takes is 2-3ms.

Is this normal time for drawing such a small image or there is some implicit conversions happening behind the scene?

I have around 40 game objects (based on sprites) that should be drawn, and the time to draw all of them in one pass takes ~100ms. This is very slow and provides only 10FPS for a dynamic game. I tried many things, like turning off anti-aliasing, turning off the alpha, etc. but to no avail.

How should I go for optimizing the drawing time to get 25FPS at least?

Thanks,

Zlatko