Getting the dirty area inside the drawing ()

If I have an invalid () part of my user view with a dirty rectangle parameter, how do I get a dirty rectangle inside the draw () method? The cutout rectangle of the canvas is not the same - in my experience it is usually several times larger.

+2
android
source share
2 answers

If the dirty rectangle does not match the one you passed invalidate (), this is because another view or area of ​​the screen is also invalid.

+3
source share

get clipRect from the onDraw method object passed to Canvas. This clipRect (Canvas :: getClipBounds) is actually an invalid Rect.

Sometimes clipRect is larger because different invalid areas are combined together, so that one event is fired rather than fired multiple for performance reasons.

+2
source share

All Articles