Ah. Okay. I understand this more and more every time I read a post by you
or re-watch the Android Accelerated Rending talk from last year's I/O.

So what if I'm drawing a Bitmap to the Canvas in that View's onDraw, rather
than making canvas drawing calls?

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. 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.

Is there a way I can use hardware acceleration so I can take advantage of
the rendering framework and not have overlapping or parent/child View's
invalidated as well, while still only invalidating and updating part of my
View using a Bitmap cache?

(Please let me know if there's still something I'm not understanding
correctly).

Thanks,
Andrew

On Fri, Jan 20, 2012 at 1:11 PM, Romain Guy <[email protected]> wrote:

> > I would expect (though my expectation could very well be wrong :P) that
> when
> > I call invalidate(Rect) on a hardware accelerated View, that onDraw()
> would
> > get called on that view with the Canvas clip set to the Rect provided in
> > invalidate(Rect) and that only that portion of the Canvas would need to
> be
> > updated.
>
> onDraw() will get called but you won't get the Rect you've provided in
> invalidate(Rect). What will happen however is that the rendering
> pipeline will only execute the drawing instructions that intersect
> with the Rect you've supplied with your invalidate call. When onDraw()
> is executed, your drawing calls are only recorded for later use. At
> playback time they can be ignored.
>
> > What I am experiencing is that I call invalidate(Rect) on a hardware
> > accelerated View and that onDraw() is called with a Canvas containing no
> > clip and the Canvas is blank, so I need to redraw the entire Canvas.
>
> There is no such concept as "blank Canvas." The clip will indeed be
> set to be the entire View (to properly rebuild its display list.)
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> --
> 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
>

-- 
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