diff options
author | sunnyps <sunnyps@chromium.org> | 2015-06-19 20:35:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-20 03:35:50 +0000 |
commit | 8bc37c759748f4ae5a57ea7f62003180691d82d7 (patch) | |
tree | df3fc144f010a0d26bd731395cc12a34839ba935 /cc | |
parent | 0f0d65fb73868cee9a76c2de8fe252c503b099c5 (diff) | |
download | chromium_src-8bc37c759748f4ae5a57ea7f62003180691d82d7.zip chromium_src-8bc37c759748f4ae5a57ea7f62003180691d82d7.tar.gz chromium_src-8bc37c759748f4ae5a57ea7f62003180691d82d7.tar.bz2 |
cc: Fix surface damage calculation.
The surface damage calculation did not take target transform into
account. This caused issues with browser plugins which started using
surfaces recently.
BUG=500891
TEST=SurfaceAggregatorValidSurfaceTest.AggregateDamageRect
R=danakj
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1194163002
Cr-Commit-Position: refs/heads/master@{#335428}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/surfaces/surface_aggregator.cc | 13 | ||||
-rw-r--r-- | cc/surfaces/surface_aggregator_unittest.cc | 48 |
2 files changed, 44 insertions, 17 deletions
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc index e1ee987..5bac2df 100644 --- a/cc/surfaces/surface_aggregator.cc +++ b/cc/surfaces/surface_aggregator.cc @@ -274,15 +274,15 @@ void SurfaceAggregator::HandleSurfaceQuad( dest_pass_list_->push_back(copy_pass.Pass()); } + gfx::Transform surface_transform = + surface_quad->shared_quad_state->quad_to_target_transform; + surface_transform.ConcatTransform(target_transform); + const RenderPass& last_pass = *render_pass_list.back(); if (merge_pass) { // TODO(jamesr): Clean up last pass special casing. const QuadList& quads = last_pass.quad_list; - gfx::Transform surface_transform = - surface_quad->shared_quad_state->quad_to_target_transform; - surface_transform.ConcatTransform(target_transform); - // Intersect the transformed visible rect and the clip rect to create a // smaller cliprect for the quad. ClipData surface_quad_clip_rect( @@ -321,11 +321,10 @@ void SurfaceAggregator::HandleSurfaceQuad( gfx::Vector2dF(), FilterOperations()); } + dest_pass->damage_rect = gfx::UnionRects( dest_pass->damage_rect, - MathUtil::MapEnclosingClippedRect( - surface_quad->shared_quad_state->quad_to_target_transform, - surface_damage)); + MathUtil::MapEnclosingClippedRect(surface_transform, surface_damage)); referenced_surfaces_.erase(it); } diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc index b657efa..e4ade82 100644 --- a/cc/surfaces/surface_aggregator_unittest.cc +++ b/cc/surfaces/surface_aggregator_unittest.cc @@ -1049,12 +1049,9 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) { // Tests that damage rects are aggregated correctly when surfaces change. TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { - SurfaceId child_surface_id = allocator_.GenerateId(); - factory_.Create(child_surface_id); - RenderPassId child_pass_id = RenderPassId(1, 1); - test::Quad child_quads[] = {test::Quad::RenderPassQuad(child_pass_id)}; + test::Quad child_quads[] = {test::Quad::RenderPassQuad(RenderPassId(1, 1))}; test::Pass child_passes[] = { - test::Pass(child_quads, arraysize(child_quads), child_pass_id)}; + test::Pass(child_quads, arraysize(child_quads), RenderPassId(1, 1))}; RenderPassList child_pass_list; AddPasses(&child_pass_list, @@ -1073,16 +1070,47 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); child_frame->delegated_frame_data = child_frame_data.Pass(); + SurfaceId child_surface_id = allocator_.GenerateId(); + factory_.Create(child_surface_id); factory_.SubmitFrame(child_surface_id, child_frame.Pass(), SurfaceFactory::DrawCallback()); - RenderPassId pass_id(5, 10); - test::Quad first_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; - test::Quad root_quads[] = {test::Quad::RenderPassQuad(pass_id)}; + test::Quad parent_surface_quads[] = { + test::Quad::SurfaceQuad(child_surface_id, 1.f)}; + test::Pass parent_surface_passes[] = { + test::Pass(parent_surface_quads, arraysize(parent_surface_quads), + RenderPassId(1, 1))}; + + RenderPassList parent_surface_pass_list; + AddPasses(&parent_surface_pass_list, + gfx::Rect(SurfaceSize()), + parent_surface_passes, + arraysize(parent_surface_passes)); + + // Parent surface is only used to test if the transform is applied correctly + // to the child surface's damage. + scoped_ptr<DelegatedFrameData> parent_surface_frame_data( + new DelegatedFrameData); + parent_surface_pass_list.swap(parent_surface_frame_data->render_pass_list); + + scoped_ptr<CompositorFrame> parent_surface_frame(new CompositorFrame); + parent_surface_frame->delegated_frame_data = parent_surface_frame_data.Pass(); + + SurfaceId parent_surface_id = allocator_.GenerateId(); + factory_.Create(parent_surface_id); + factory_.SubmitFrame(parent_surface_id, parent_surface_frame.Pass(), + SurfaceFactory::DrawCallback()); + + test::Quad root_surface_quads[] = { + test::Quad::SurfaceQuad(parent_surface_id, 1.f)}; + test::Quad root_render_pass_quads[] = { + test::Quad::RenderPassQuad(RenderPassId(1, 1))}; test::Pass root_passes[] = { - test::Pass(first_quads, arraysize(first_quads), pass_id), - test::Pass(root_quads, arraysize(root_quads))}; + test::Pass(root_surface_quads, arraysize(root_surface_quads), + RenderPassId(1, 1)), + test::Pass(root_render_pass_quads, arraysize(root_render_pass_quads), + RenderPassId(2, 1))}; RenderPassList root_pass_list; AddPasses(&root_pass_list, |