| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/delegated_renderer_layer_impl.h" | 5 #include "cc/layers/delegated_renderer_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/base/scoped_ptr_vector.h" | 7 #include "cc/base/scoped_ptr_vector.h" |
| 8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
| 9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
| 10 #include "cc/layers/solid_color_layer_impl.h" | 10 #include "cc/layers/solid_color_layer_impl.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 { | 522 { |
| 523 TestRenderPass* pass = AddRenderPass( | 523 TestRenderPass* pass = AddRenderPass( |
| 524 &delegated_render_passes, | 524 &delegated_render_passes, |
| 525 RenderPass::Id(10, 7), | 525 RenderPass::Id(10, 7), |
| 526 child_pass_rect, | 526 child_pass_rect, |
| 527 gfx::Transform()); | 527 gfx::Transform()); |
| 528 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 528 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 529 AppendQuadsData data(pass->id); | 529 AppendQuadsData data(pass->id); |
| 530 SharedQuadState* shared_quad_state = quad_sink.UseSharedQuadState( | 530 SharedQuadState* shared_quad_state = quad_sink.UseSharedQuadState( |
| 531 SharedQuadState::Create()); | 531 SharedQuadState::Create()); |
| 532 shared_quad_state->SetAll( | 532 shared_quad_state->SetAll(child_pass_transform, |
| 533 child_pass_transform, | 533 child_pass_content_bounds, |
| 534 child_pass_content_bounds, | 534 child_pass_rect, |
| 535 child_pass_rect, | 535 child_pass_clip_rect, |
| 536 child_pass_clip_rect, | 536 child_pass_clipped, |
| 537 child_pass_clipped, | 537 1.f, |
| 538 1.f); | 538 SkXfermode::kSrcOver_Mode); |
| 539 | 539 |
| 540 scoped_ptr<SolidColorDrawQuad> color_quad; | 540 scoped_ptr<SolidColorDrawQuad> color_quad; |
| 541 color_quad = SolidColorDrawQuad::Create(); | 541 color_quad = SolidColorDrawQuad::Create(); |
| 542 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); | 542 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); |
| 543 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 543 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 544 | 544 |
| 545 color_quad = SolidColorDrawQuad::Create(); | 545 color_quad = SolidColorDrawQuad::Create(); |
| 546 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); | 546 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); |
| 547 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 547 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 548 } | 548 } |
| 549 | 549 |
| 550 gfx::Size root_pass_content_bounds(100, 100); | 550 gfx::Size root_pass_content_bounds(100, 100); |
| 551 gfx::Rect root_pass_rect(0, 0, 100, 100); | 551 gfx::Rect root_pass_rect(0, 0, 100, 100); |
| 552 gfx::Transform root_pass_transform; | 552 gfx::Transform root_pass_transform; |
| 553 root_pass_transform.Scale(1.5, 1.5); | 553 root_pass_transform.Scale(1.5, 1.5); |
| 554 root_pass_transform.Translate(7.0, 7.0); | 554 root_pass_transform.Translate(7.0, 7.0); |
| 555 gfx::Rect root_pass_clip_rect(10, 10, 35, 35); | 555 gfx::Rect root_pass_clip_rect(10, 10, 35, 35); |
| 556 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; | 556 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; |
| 557 | 557 |
| 558 TestRenderPass* pass = AddRenderPass( | 558 TestRenderPass* pass = AddRenderPass( |
| 559 &delegated_render_passes, | 559 &delegated_render_passes, |
| 560 RenderPass::Id(9, 6), | 560 RenderPass::Id(9, 6), |
| 561 root_pass_rect, | 561 root_pass_rect, |
| 562 gfx::Transform()); | 562 gfx::Transform()); |
| 563 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 563 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 564 AppendQuadsData data(pass->id); | 564 AppendQuadsData data(pass->id); |
| 565 SharedQuadState* shared_quad_state = | 565 SharedQuadState* shared_quad_state = |
| 566 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 566 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 567 shared_quad_state->SetAll( | 567 shared_quad_state->SetAll(root_pass_transform, |
| 568 root_pass_transform, | 568 root_pass_content_bounds, |
| 569 root_pass_content_bounds, | 569 root_pass_rect, |
| 570 root_pass_rect, | 570 root_pass_clip_rect, |
| 571 root_pass_clip_rect, | 571 root_pass_clipped, |
| 572 root_pass_clipped, | 572 1.f, |
| 573 1.f); | 573 SkXfermode::kSrcOver_Mode); |
| 574 | 574 |
| 575 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 575 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 576 RenderPassDrawQuad::Create(); | 576 RenderPassDrawQuad::Create(); |
| 577 render_pass_quad->SetNew( | 577 render_pass_quad->SetNew( |
| 578 shared_quad_state, | 578 shared_quad_state, |
| 579 gfx::Rect(5, 5, 7, 7), // rect | 579 gfx::Rect(5, 5, 7, 7), // rect |
| 580 RenderPass::Id(10, 7), // render_pass_id | 580 RenderPass::Id(10, 7), // render_pass_id |
| 581 false, // is_replica | 581 false, // is_replica |
| 582 0, // mask_resource_id | 582 0, // mask_resource_id |
| 583 child_pass_rect, // contents_changed_since_last_frame | 583 child_pass_rect, // contents_changed_since_last_frame |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 { | 926 { |
| 927 TestRenderPass* pass = AddRenderPass( | 927 TestRenderPass* pass = AddRenderPass( |
| 928 &delegated_render_passes, | 928 &delegated_render_passes, |
| 929 RenderPass::Id(10, 7), | 929 RenderPass::Id(10, 7), |
| 930 child_pass_rect, | 930 child_pass_rect, |
| 931 gfx::Transform()); | 931 gfx::Transform()); |
| 932 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 932 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 933 AppendQuadsData data(pass->id); | 933 AppendQuadsData data(pass->id); |
| 934 SharedQuadState* shared_quad_state = | 934 SharedQuadState* shared_quad_state = |
| 935 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 935 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 936 shared_quad_state->SetAll( | 936 shared_quad_state->SetAll(child_pass_transform, |
| 937 child_pass_transform, | 937 child_pass_content_bounds, |
| 938 child_pass_content_bounds, | 938 child_pass_rect, |
| 939 child_pass_rect, | 939 child_pass_clip_rect, |
| 940 child_pass_clip_rect, | 940 child_pass_clipped, |
| 941 child_pass_clipped, | 941 1.f, |
| 942 1.f); | 942 SkXfermode::kSrcOver_Mode); |
| 943 | 943 |
| 944 scoped_ptr<SolidColorDrawQuad> color_quad; | 944 scoped_ptr<SolidColorDrawQuad> color_quad; |
| 945 color_quad = SolidColorDrawQuad::Create(); | 945 color_quad = SolidColorDrawQuad::Create(); |
| 946 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); | 946 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); |
| 947 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 947 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 948 | 948 |
| 949 color_quad = SolidColorDrawQuad::Create(); | 949 color_quad = SolidColorDrawQuad::Create(); |
| 950 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); | 950 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); |
| 951 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 951 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 952 } | 952 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 964 gfx::Transform()); | 964 gfx::Transform()); |
| 965 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 965 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 966 AppendQuadsData data(pass->id); | 966 AppendQuadsData data(pass->id); |
| 967 SharedQuadState* shared_quad_state = | 967 SharedQuadState* shared_quad_state = |
| 968 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 968 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 969 shared_quad_state->SetAll(root_pass_transform, | 969 shared_quad_state->SetAll(root_pass_transform, |
| 970 root_pass_content_bounds, | 970 root_pass_content_bounds, |
| 971 root_pass_rect, | 971 root_pass_rect, |
| 972 root_pass_clip_rect, | 972 root_pass_clip_rect, |
| 973 root_pass_clipped, | 973 root_pass_clipped, |
| 974 1.f); | 974 1.f, |
| 975 SkXfermode::kSrcOver_Mode); |
| 975 | 976 |
| 976 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 977 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 977 RenderPassDrawQuad::Create(); | 978 RenderPassDrawQuad::Create(); |
| 978 render_pass_quad->SetNew( | 979 render_pass_quad->SetNew( |
| 979 shared_quad_state, | 980 shared_quad_state, |
| 980 gfx::Rect(5, 5, 7, 7), // rect | 981 gfx::Rect(5, 5, 7, 7), // rect |
| 981 RenderPass::Id(10, 7), // render_pass_id | 982 RenderPass::Id(10, 7), // render_pass_id |
| 982 false, // is_replica | 983 false, // is_replica |
| 983 0, // mask_resource_id | 984 0, // mask_resource_id |
| 984 child_pass_rect, // contents_changed_since_last_frame | 985 child_pass_rect, // contents_changed_since_last_frame |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 1326 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| 1326 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 1327 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
| 1327 frame.render_passes[0]->quad_list[0]->material); | 1328 frame.render_passes[0]->quad_list[0]->material); |
| 1328 | 1329 |
| 1329 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 1330 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 1330 host_impl_->DidDrawAllLayers(frame); | 1331 host_impl_->DidDrawAllLayers(frame); |
| 1331 } | 1332 } |
| 1332 | 1333 |
| 1333 } // namespace | 1334 } // namespace |
| 1334 } // namespace cc | 1335 } // namespace cc |
| OLD | NEW |