Sunday, September 15, 2013

Which is faster canvas.drawArc()/drawPath() or canvas.drawBitmap()?

Which is faster canvas.drawArc()/drawPath() or canvas.drawBitmap()?

I have a custom view in which I currently its background using a bitmap in
the onDraw() method. The Bitmap is actually created by the view itself
whenever the onSizeChanged() method is called and typically consists of
drawing some arcs, paths etc into the bitmap and then I use this bitmap in
onDraw(). I did this in the belief that it is more efficient/faster for
the system to draw a Bitmap using Canvas.drawBitmap() than doing each
individual call to drawArc() or drawPath() in onDraw(). Or is it?
The background itself does not change often except if there is a resize or
colour change of one of the Paint objects but the onDraw() method is
called often so am I drawing the background in the most efficient manner?

No comments:

Post a Comment