Small optimization in cc::DamageTracker.
Two steps are used to track if a surface intersects damage from under it. 1) When the surface (assume A) accumulates damage in AccumulateDamageFromRenderSurface(), if the surface doesn't intersect any damage, it would be appended to the vector |surfaces_with_no_damage_under|. 2) When surface A's render target (assume B) computes damage from left-over rects in ComputeSurfaceDamage(), A (and all other surfaces rendering to B) will be removed from the vector |surfaces_with_no_damage_under|. For example, suppose, nodes below all represent render surfaces. A / \ B C /\ /\ G H J K B,C renders to A; G,H renders to B; J,K renders to C. The draw order is K, J, C, H, G, B, A. During damage tracking, G and H, for instance, will be added to the vector when they each AccumulateDamageFromRenderSurface(), and then when their parent B ComputeSurfaceDamage(), both G and H will be removed from the vector. This means the vector's use pattern is similar to a stack: a surface's children will first be appended to the vector, and then the surface itself will be inserted into the vector after all its children are removed. Based on such an idea, in this CL, ComputeSurfaceDamage() no longer iterates through all elements in the vector, but rather, stops at the first element that's not current surface's children. Bug: N/A Change-Id: I22a022530f6869a5dd3b07f900da2c3e1ede2079 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582843 Commit-Queue: weiliangc <weiliangc@chromium.org> Reviewed-by:weiliangc <weiliangc@chromium.org> Auto-Submit: Jun Liu <yjliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#839160}
Showing
Please register or sign in to comment