Partial invalidation in custom Android view with hardware acceleration

后端 未结 2 1103
后悔当初
后悔当初 2020-11-30 09:25

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

相关标签:
2条回答
  • 2020-11-30 09:50

    When HA is enabled, the rendering pipeline will use DisplayList to store the drawing commands. Even if you specify the dirty region in View.invalidate, the whole displaylist will be rebuilt (just think that how can we only update a small set of DisplayList, that's impossible right?). Eventually, as @Romain says, only the real dirty region will be redrawn.

    0 讨论(0)
  • 2020-11-30 10:09

    Partial redraw works just fine, only the specified region of the screen will get redrawn. What it won't do however is change the clip bounds on the Canvas. All the drawing operations will be recorded but only the ones intersecting with the dirty region will actually be executed.

    Update: as of Lollipop (API 21), partial invalidation happens at the View level (i.e. you cannot invalidate less than an entire View).

    0 讨论(0)
提交回复
热议问题