Commit 88b589af authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Adjust rounded corner bounds when aggregating quads into a new target state.

The rounded_corner_bounds field of SharedQuadState needs to be in the
space of the target render surface. When changing that target, therefore,
rounded_corner_bounds needs to be updated accordingly.

Bug: 947715

Change-Id: I83b3f773d960e82d75060326c197ef12ae1755fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1590900Reviewed-by: default avatarenne <enne@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656424}
parent 605d15db
...@@ -140,6 +140,9 @@ void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const { ...@@ -140,6 +140,9 @@ void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const {
value->SetDouble("opacity", opacity); value->SetDouble("opacity", opacity);
value->SetDouble("backdrop_filter_quality", backdrop_filter_quality); value->SetDouble("backdrop_filter_quality", backdrop_filter_quality);
value->SetBoolean("is_fast_rounded_corner", is_fast_rounded_corner); value->SetBoolean("is_fast_rounded_corner", is_fast_rounded_corner);
if (is_fast_rounded_corner)
MathUtil::AddToTracedValue("rounded_corner_bounds", rounded_corner_bounds,
value);
value->SetString("blend_mode", SkBlendMode_Name(blend_mode)); value->SetString("blend_mode", SkBlendMode_Name(blend_mode));
value->SetBoolean("cache_render_surface", cache_render_surface); value->SetBoolean("cache_render_surface", cache_render_surface);
value->SetBoolean("has_copy_request", has_copy_request); value->SetBoolean("has_copy_request", has_copy_request);
......
...@@ -699,6 +699,18 @@ SharedQuadState* SurfaceAggregator::CopySharedQuadState( ...@@ -699,6 +699,18 @@ SharedQuadState* SurfaceAggregator::CopySharedQuadState(
occluding_damage_rect_valid); occluding_damage_rect_valid);
} }
gfx::RRectF MapRoundedBounds(const gfx::RRectF& old_bounds,
const gfx::Transform& transform) {
if (old_bounds.IsEmpty())
return old_bounds;
DCHECK(transform.Preserves2dAxisAlignment());
gfx::RRectF bounds(old_bounds);
SkMatrix matrix = transform.matrix();
bounds.Scale(matrix.getScaleX(), matrix.getScaleY());
bounds.Offset(transform.To2dTranslation());
return bounds;
}
SharedQuadState* SurfaceAggregator::CopyAndScaleSharedQuadState( SharedQuadState* SurfaceAggregator::CopyAndScaleSharedQuadState(
const SharedQuadState* source_sqs, const SharedQuadState* source_sqs,
const gfx::Transform& scaled_quad_to_target_transform, const gfx::Transform& scaled_quad_to_target_transform,
...@@ -725,9 +737,14 @@ SharedQuadState* SurfaceAggregator::CopyAndScaleSharedQuadState( ...@@ -725,9 +737,14 @@ SharedQuadState* SurfaceAggregator::CopyAndScaleSharedQuadState(
gfx::Transform new_transform = scaled_quad_to_target_transform; gfx::Transform new_transform = scaled_quad_to_target_transform;
new_transform.ConcatTransform(target_transform); new_transform.ConcatTransform(target_transform);
// The rounded corner bounds need to be in the space of the target. Since
// the target may have changed, apply the extra transform to the new target.
gfx::RRectF new_bounds =
MapRoundedBounds(*rounded_corner_info.bounds, target_transform);
shared_quad_state->SetAll( shared_quad_state->SetAll(
new_transform, quad_layer_rect, visible_quad_layer_rect, new_transform, quad_layer_rect, visible_quad_layer_rect, new_bounds,
*rounded_corner_info.bounds, new_clip_rect.rect, new_clip_rect.is_clipped, new_clip_rect.rect, new_clip_rect.is_clipped,
source_sqs->are_contents_opaque, source_sqs->opacity, source_sqs->are_contents_opaque, source_sqs->opacity,
source_sqs->blend_mode, source_sqs->sorting_context_id); source_sqs->blend_mode, source_sqs->sorting_context_id);
shared_quad_state->is_fast_rounded_corner = shared_quad_state->is_fast_rounded_corner =
......
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