Tuesday, August 30, 2011

[android-developers] Partial invalidation in custom Android view with hardware acceleration

Hi,

I've got a custom View in my application which fills the entire
activity.

In most cases, when I want to refresh the control I call invalidate()
without any parameters.

However, in certain circumstances, where I'm only changing a small
area of the control, I call invalidate(Rect) to avoid redrawing the
entire screen. This is important because in these situations I need
the update to be as fast as possible.

This seems to work fine, however, when I enable hardware acceleration
in Honeycomb (i.e. set android:hardwareAccelerated="true"in
AndroidManifest.xml), the partial redraw does not seem to work.

This can be seen if I do Log.d("FOO", canvas.getClipBounds()) in my
onDraw() method; the output simply shows that the whole control is
being updated, whereas with hardware acceleration disabled, I get the
correct region being output.

Is there any way to make partial invalidation work when using hardware
acceleraton?

Many thanks, Matt

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment