Commit 6618d069 authored by David Stevens's avatar David Stevens Committed by Commit Bot

Ignore tiny error in damage when aggregating surfaces

Transforming a surface's damage into its target space involves a bit of
floating point math. This can introduce small errors - for example,
scaling 1680x945 by .8 results in 1344.000122x756.000061. If we don't
ignore this error, the inflated enclosing rectangle can prevent overlay
optimizations from operating effectively.

Bug: 1113146
Change-Id: Ic08dd08180b054b2637e57ab68b1577214bec4d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2338277Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795304}
parent f7c673b7
......@@ -1444,10 +1444,14 @@ gfx::Rect SurfaceAggregator::PrewalkRenderPass(
} else {
continue;
}
// Convert the quad damage rect into its target space and clip it
// if needed.
gfx::Rect rect_in_target_space = cc::MathUtil::MapEnclosingClippedRect(
quad->shared_quad_state->quad_to_target_transform, quad_damage_rect);
// Convert the quad damage rect into its target space and clip it if
// needed. Ignore tiny errors to avoid artificially inflating the
// damage due to floating point math.
constexpr float kEpsilon = 0.001f;
gfx::Rect rect_in_target_space =
cc::MathUtil::MapEnclosingClippedRectIgnoringError(
quad->shared_quad_state->quad_to_target_transform, quad_damage_rect,
kEpsilon);
if (quad->shared_quad_state->is_clipped) {
rect_in_target_space.Intersect(quad->shared_quad_state->clip_rect);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment