Reputation: 11369
I am trying to find the best way (preformance-wise) to draw a large Bitmap
to a SurfaceView
in Android as a stationary background image. I am currently just using the Canvas.drawBitmap()
method but it brings my FPS down by a lot. What are some ways that I can speed this up?
Upvotes: 0
Views: 1374
Reputation: 250
If your background is going to be static, then you could try making the background of your layout the background image. Then put the surfaceView background as transparent:
how to make surfaceview transparent
Upvotes: 0
Reputation: 98501
Try to use an opaque image and set the Xfermode on the Paint to either null or PorterDuff.Mode.SRC. This will disable blending which can be expensive. Also make sure your image is not stretched (no scaling) and that it's in the same format as the surfaceview's surface.
Upvotes: 2