Why does partial invalidate span the entire View?

404 Views Asked by At

I am trying to partially invalidate an android View. I use View.invalidate( l, t, b, r ) and it appears to invalidate vertically (top and bottom) values correctly, however, no matter which left and right values I use, it invalidates entire across the View.

For example, my view is gray. I wish to invalidate the green area, however, it invalidates the green and red area. It always spans the entire horizontal direction entirely across the View. I have attempted to put small values such as View.invalidate( 0, 0, 50, 50 ) and it still causes this behavior.

Image Link (not enough rep to post images)

Why is this happening?

1

There are 1 best solutions below

1
On BEST ANSWER

The behavior changed with hardware accelaration, the default after Honeycomb. Now when you invalidate() a view providing a dirty region, the clip bound is not set (canvas.getClipBounds()). However, only objects intersecting the dirty region will be redrawn.

See for reference this answer by Romain Guy, the author of the rendering pipeline.