A few ideas:

you might see significant perfomance benifits by using
http://developer.android.com/reference/android/graphics/Picture.html
to cut down method invocation overhead - if you have a few frames
where the lines don't change. it might even be worth it to have it
draw offscreen lines so the picture obj needs to be updated less.

canvas.drawRect might be faster, and will only draw horz. and vertical
areas

if you have free memory, drawing to a cache of bitmaps and blitting
the result could be faster

-rob



On Jul 31, 4:56 pm, f_heft <[email protected]> wrote:
> Hello,
>
> I'm developing a SurfaceView based, vector-styled game, so I'm using
> Canvas.drawLine(startX, startY, stopX, stopY, Paint) very often. All
> those lines are rectangular (startX=stopX or startY=stopY).
> The TraceViewer shows me, that more than 50% of time are used to draw
> those lines (about 100 per frame).
>
> I read that drawLine is pretty slow on Android but I didn't find any
> suggestions for an alternative.
> What could be a faster method for this special case? I wouldn't need
> the Bresenham algorithm for example, which drawLine will use I guess.
>
> Any suggestions?
> (Besides 'use openGL', as it's too late for that)
>
> Regards, F Heft
>
> PS: If anyone's interested: The game still runs with a sufficient
> frame rate, but I want to improve wherever I can :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to