Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load bitmap or draw graphic? Performance Question

Ok, I am going to be drawing a lot of "insects" on the screen. My question is, if I am drawing a spider for example, would it be faster to load a bitmap, matrix it to the correct angle, and draw it on screen (again and again), or draw an ant using the canvas.drawLine, drawCircle, etc? For a direct comparison:

Bitmap: 500 bytes w/ transparency

Drawn: 8 drawLines, 2 drawCircles

I already have a lot going on, so performance here is very important.

Thanks in advance!

like image 645
teynon Avatar asked Oct 24 '22 15:10

teynon


1 Answers

It is much faster to draw a bitmap. What really matters is how many pixels you are going to draw (i.e. the overdraw, which will impact the maximum fillrate.) Using bitmaps also allows you to create richer graphics without performance penalties.

like image 50
Romain Guy Avatar answered Oct 27 '22 10:10

Romain Guy