Hi Compose Team: I found from the source code of C...
# compose-android
z
Hi Compose Team: I found from the source code of Compose that no matter which View calls the invalidate(), it will trigger the invalidateLayer() function of NodeCoordinator, thereby indirectly or directly calling the invalidate() of ownerView (AndroidComposeView). I would like to ask why AndroidComposeView must also be invalidated? If AndroidComposeView is not invalidated, will there be any abnormality in drawing?
e
This answers your question, no? At least what i understand is that the compose view will be invalidated (so that the view system ie its ancestors etc knows to redraw it) but within the compose view the small area/rect that has changed is what will actually be redrawn 🤔
z
Actually not, the result of my test is that no matter which View is invalidated, the entire AndroidComposeView will be redrawn. Although Recomposition only occurs locally, the redraw is indeed full-screen (generally speaking, AndroidComposeView is full-screen)
e
Yeah I dont claim to know the details tbh. Probably what I described about drawing a small area (in compose) is the end goal / an ideal but just not implemented yet? Or maybe something else. Will leave framework devs to reply
But your question about why the compose view must be invalidated is answered (i believe): “Its how the platform works” Views will invalidate all ancestors (i assume because its a view parent that directs its children to draw) but redrawing (don’t quote me) would happen only in the area of the child/descendant view that has changed.
👌 1
c
I'd file a bug to get more visibility in front of the compose team. I'll +1 it if you post here!
âž• 1