Commit 5b0f31f6 authored by Weiliang Chen's avatar Weiliang Chen Committed by Commit Bot

cc: Always use SetNew to modify SharedQuadState data

Always calls SetNew right after creating SharedQuadstate to set all the
values on SharedQuadState. This is to help catch all cases when
switching to use id in later CLs.

R=danakj@chromium.org

Bug: 739429
Change-Id: I029f73d2ff3b261ce12da65ba7eb49b6323f37c1
Reviewed-on: https://chromium-review.googlesource.com/596768
Commit-Queue: weiliangc <weiliangc@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491417}
parent 7e01241f
...@@ -340,9 +340,13 @@ void FastInkView::UpdateSurface() { ...@@ -340,9 +340,13 @@ void FastInkView::UpdateSurface() {
cc::SharedQuadState* quad_state = cc::SharedQuadState* quad_state =
render_pass->CreateAndAppendSharedQuadState(); render_pass->CreateAndAppendSharedQuadState();
quad_state->quad_layer_rect = quad_rect; quad_state->SetAll(
quad_state->visible_quad_layer_rect = quad_rect; /*quad_to_target_transform=*/gfx::Transform(),
quad_state->opacity = 1.0f; /*quad_layer_rect=*/quad_rect,
/*visible_quad_layer_rect=*/quad_rect,
/*clip_rect=*/gfx::Rect(),
/*is_clipped=*/false, /*opacity=*/1.f,
/*blend_mode=*/SkBlendMode::kSrcOver, /*sorting_context_id=*/0);
cc::CompositorFrame frame; cc::CompositorFrame frame;
// TODO(eseckler): FastInkView should use BeginFrames and set the ack // TODO(eseckler): FastInkView should use BeginFrames and set the ack
......
...@@ -664,9 +664,12 @@ void Surface::AppendContentsToFrame(const gfx::Point& origin, ...@@ -664,9 +664,12 @@ void Surface::AppendContentsToFrame(const gfx::Point& origin,
render_pass->damage_rect.Union(damage_rect); render_pass->damage_rect.Union(damage_rect);
cc::SharedQuadState* quad_state = cc::SharedQuadState* quad_state =
render_pass->CreateAndAppendSharedQuadState(); render_pass->CreateAndAppendSharedQuadState();
quad_state->quad_layer_rect = gfx::Rect(content_size_); quad_state->SetAll(
quad_state->visible_quad_layer_rect = quad_rect; gfx::Transform() /* quad_to_target_transform */,
quad_state->opacity = state_.alpha; gfx::Rect(content_size_) /* quad_layer_rect */,
quad_rect /* visible_quad_layer_rect */, gfx::Rect() /* clip_rect */,
false /* is_clipped */, state_.alpha /* opacity */,
SkBlendMode::kSrcOver /* blend_mode */, 0 /* sorting_context_id */);
if (current_resource_.id) { if (current_resource_.id) {
gfx::PointF uv_top_left(0.f, 0.f); gfx::PointF uv_top_left(0.f, 0.f);
......
...@@ -379,9 +379,13 @@ void SurfaceAggregator::AddColorConversionPass() { ...@@ -379,9 +379,13 @@ void SurfaceAggregator::AddColorConversionPass() {
auto* shared_quad_state = auto* shared_quad_state =
color_conversion_pass->CreateAndAppendSharedQuadState(); color_conversion_pass->CreateAndAppendSharedQuadState();
shared_quad_state->quad_layer_rect = output_rect; shared_quad_state->SetAll(
shared_quad_state->visible_quad_layer_rect = output_rect; /*quad_to_target_transform=*/gfx::Transform(),
shared_quad_state->opacity = 1.f; /*quad_layer_rect=*/output_rect,
/*visible_quad_layer_rect=*/output_rect,
/*clip_rect=*/gfx::Rect(),
/*is_clipped=*/false, /*opacity=*/1.f,
/*blend_mode=*/SkBlendMode::kSrcOver, /*sorting_context_id=*/0);
auto* quad = auto* quad =
color_conversion_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); color_conversion_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>();
...@@ -398,21 +402,23 @@ cc::SharedQuadState* SurfaceAggregator::CopySharedQuadState( ...@@ -398,21 +402,23 @@ cc::SharedQuadState* SurfaceAggregator::CopySharedQuadState(
cc::RenderPass* dest_render_pass) { cc::RenderPass* dest_render_pass) {
auto* copy_shared_quad_state = auto* copy_shared_quad_state =
dest_render_pass->CreateAndAppendSharedQuadState(); dest_render_pass->CreateAndAppendSharedQuadState();
*copy_shared_quad_state = *source_sqs;
// target_transform contains any transformation that may exist // target_transform contains any transformation that may exist
// between the context that these quads are being copied from (i.e. the // between the context that these quads are being copied from (i.e. the
// surface's draw transform when aggregated from within a surface) to the // surface's draw transform when aggregated from within a surface) to the
// target space of the pass. This will be identity except when copying the // target space of the pass. This will be identity except when copying the
// root draw pass from a surface into a pass when the surface draw quad's // root draw pass from a surface into a pass when the surface draw quad's
// transform is not identity. // transform is not identity.
copy_shared_quad_state->quad_to_target_transform.ConcatTransform( gfx::Transform new_transform = source_sqs->quad_to_target_transform;
target_transform); new_transform.ConcatTransform(target_transform);
ClipData new_clip_rect = CalculateClipRect( ClipData new_clip_rect = CalculateClipRect(
clip_rect, ClipData(source_sqs->is_clipped, source_sqs->clip_rect), clip_rect, ClipData(source_sqs->is_clipped, source_sqs->clip_rect),
target_transform); target_transform);
copy_shared_quad_state->is_clipped = new_clip_rect.is_clipped; copy_shared_quad_state->SetAll(new_transform, source_sqs->quad_layer_rect,
copy_shared_quad_state->clip_rect = new_clip_rect.rect; source_sqs->visible_quad_layer_rect,
new_clip_rect.rect, new_clip_rect.is_clipped,
source_sqs->opacity, source_sqs->blend_mode,
source_sqs->sorting_context_id);
return copy_shared_quad_state; return copy_shared_quad_state;
} }
......
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