> The reason for this is one of the things I'm drawing in the View are lines
> (potentially lots of them), and hardware acceleration does not support AA
> for drawing lines.

It does as of API level 12 (Android 3.2.) I would recommend you switch
to using hardware AA lines if possible (all devices that shipped with
API level 11 should have now be upgraded to 12.) Make sure to use
drawLines() as well to batch the geometry.

> So, I draw everything to a Bitmap cache and simply update
> a section of the Bitmap cache when the View's data is updated, then I call
> invalidate(Rect) hoping to only update the View's Canvas with that portion
> of the Bitmap cache that was updated. But I end up redrawing the entire
> Canvas every time. This ends up being a lot slower than doing the same
> technique without hardware acceleration enabled.

Since you are doing your own buffering I would recommend you keep
track of the dirty region yourself. Note that you could instead set
your View's layer type to be LAYER_TYPE_SOFTWARE. If you do so, the
View will be drawn into a Bitmap for you *and* the clip rect in
onDraw() will be the same as when you call invalidate(Rect).

Note however that the rendering engine will have to upload the entire
bitmap as a texture which can be expensive.

-- 
Romain Guy
Android framework engineer
romain...@android.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to