| 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/debug/test_web_graphics_context_3d.h" | 8 #include "cc/debug/test_web_graphics_context_3d.h" |
| 9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/layers/quad_sink.h" | 10 #include "cc/layers/quad_sink.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 { | 488 { |
| 489 TestRenderPass* pass = AddRenderPass( | 489 TestRenderPass* pass = AddRenderPass( |
| 490 &delegated_render_passes, | 490 &delegated_render_passes, |
| 491 RenderPass::Id(10, 7), | 491 RenderPass::Id(10, 7), |
| 492 child_pass_rect, | 492 child_pass_rect, |
| 493 gfx::Transform()); | 493 gfx::Transform()); |
| 494 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 494 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 495 AppendQuadsData data(pass->id); | 495 AppendQuadsData data(pass->id); |
| 496 SharedQuadState* shared_quad_state = quad_sink.UseSharedQuadState( | 496 SharedQuadState* shared_quad_state = quad_sink.UseSharedQuadState( |
| 497 SharedQuadState::Create()); | 497 SharedQuadState::Create()); |
| 498 shared_quad_state->SetAll( | 498 shared_quad_state->SetAll(child_pass_transform, |
| 499 child_pass_transform, | 499 child_pass_content_bounds, |
| 500 child_pass_content_bounds, | 500 child_pass_rect, |
| 501 child_pass_rect, | 501 child_pass_clip_rect, |
| 502 child_pass_clip_rect, | 502 child_pass_clipped, |
| 503 child_pass_clipped, | 503 1.f, |
| 504 1.f); | 504 SkXfermode::kSrcOver_Mode); |
| 505 | 505 |
| 506 scoped_ptr<SolidColorDrawQuad> color_quad; | 506 scoped_ptr<SolidColorDrawQuad> color_quad; |
| 507 color_quad = SolidColorDrawQuad::Create(); | 507 color_quad = SolidColorDrawQuad::Create(); |
| 508 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); | 508 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); |
| 509 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 509 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 510 | 510 |
| 511 color_quad = SolidColorDrawQuad::Create(); | 511 color_quad = SolidColorDrawQuad::Create(); |
| 512 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); | 512 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); |
| 513 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 513 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 514 } | 514 } |
| 515 | 515 |
| 516 gfx::Size root_pass_content_bounds(100, 100); | 516 gfx::Size root_pass_content_bounds(100, 100); |
| 517 gfx::Rect root_pass_rect(0, 0, 100, 100); | 517 gfx::Rect root_pass_rect(0, 0, 100, 100); |
| 518 gfx::Transform root_pass_transform; | 518 gfx::Transform root_pass_transform; |
| 519 root_pass_transform.Scale(1.5, 1.5); | 519 root_pass_transform.Scale(1.5, 1.5); |
| 520 root_pass_transform.Translate(7.0, 7.0); | 520 root_pass_transform.Translate(7.0, 7.0); |
| 521 gfx::Rect root_pass_clip_rect(10, 10, 35, 35); | 521 gfx::Rect root_pass_clip_rect(10, 10, 35, 35); |
| 522 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; | 522 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; |
| 523 | 523 |
| 524 TestRenderPass* pass = AddRenderPass( | 524 TestRenderPass* pass = AddRenderPass( |
| 525 &delegated_render_passes, | 525 &delegated_render_passes, |
| 526 RenderPass::Id(9, 6), | 526 RenderPass::Id(9, 6), |
| 527 root_pass_rect, | 527 root_pass_rect, |
| 528 gfx::Transform()); | 528 gfx::Transform()); |
| 529 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 529 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 530 AppendQuadsData data(pass->id); | 530 AppendQuadsData data(pass->id); |
| 531 SharedQuadState* shared_quad_state = | 531 SharedQuadState* shared_quad_state = |
| 532 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 532 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 533 shared_quad_state->SetAll( | 533 shared_quad_state->SetAll(root_pass_transform, |
| 534 root_pass_transform, | 534 root_pass_content_bounds, |
| 535 root_pass_content_bounds, | 535 root_pass_rect, |
| 536 root_pass_rect, | 536 root_pass_clip_rect, |
| 537 root_pass_clip_rect, | 537 root_pass_clipped, |
| 538 root_pass_clipped, | 538 1.f, |
| 539 1.f); | 539 SkXfermode::kSrcOver_Mode); |
| 540 | 540 |
| 541 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 541 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 542 RenderPassDrawQuad::Create(); | 542 RenderPassDrawQuad::Create(); |
| 543 render_pass_quad->SetNew( | 543 render_pass_quad->SetNew( |
| 544 shared_quad_state, | 544 shared_quad_state, |
| 545 gfx::Rect(5, 5, 7, 7), // rect | 545 gfx::Rect(5, 5, 7, 7), // rect |
| 546 RenderPass::Id(10, 7), // render_pass_id | 546 RenderPass::Id(10, 7), // render_pass_id |
| 547 false, // is_replica | 547 false, // is_replica |
| 548 0, // mask_resource_id | 548 0, // mask_resource_id |
| 549 child_pass_rect, // contents_changed_since_last_frame | 549 child_pass_rect, // contents_changed_since_last_frame |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 { | 892 { |
| 893 TestRenderPass* pass = AddRenderPass( | 893 TestRenderPass* pass = AddRenderPass( |
| 894 &delegated_render_passes, | 894 &delegated_render_passes, |
| 895 RenderPass::Id(10, 7), | 895 RenderPass::Id(10, 7), |
| 896 child_pass_rect, | 896 child_pass_rect, |
| 897 gfx::Transform()); | 897 gfx::Transform()); |
| 898 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 898 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 899 AppendQuadsData data(pass->id); | 899 AppendQuadsData data(pass->id); |
| 900 SharedQuadState* shared_quad_state = | 900 SharedQuadState* shared_quad_state = |
| 901 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 901 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 902 shared_quad_state->SetAll( | 902 shared_quad_state->SetAll(child_pass_transform, |
| 903 child_pass_transform, | 903 child_pass_content_bounds, |
| 904 child_pass_content_bounds, | 904 child_pass_rect, |
| 905 child_pass_rect, | 905 child_pass_clip_rect, |
| 906 child_pass_clip_rect, | 906 child_pass_clipped, |
| 907 child_pass_clipped, | 907 1.f, |
| 908 1.f); | 908 SkXfermode::kSrcOver_Mode); |
| 909 | 909 |
| 910 scoped_ptr<SolidColorDrawQuad> color_quad; | 910 scoped_ptr<SolidColorDrawQuad> color_quad; |
| 911 color_quad = SolidColorDrawQuad::Create(); | 911 color_quad = SolidColorDrawQuad::Create(); |
| 912 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); | 912 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u, false); |
| 913 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 913 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 914 | 914 |
| 915 color_quad = SolidColorDrawQuad::Create(); | 915 color_quad = SolidColorDrawQuad::Create(); |
| 916 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); | 916 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u, false); |
| 917 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); | 917 quad_sink.Append(color_quad.PassAs<DrawQuad>(), &data); |
| 918 } | 918 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 930 gfx::Transform()); | 930 gfx::Transform()); |
| 931 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); | 931 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); |
| 932 AppendQuadsData data(pass->id); | 932 AppendQuadsData data(pass->id); |
| 933 SharedQuadState* shared_quad_state = | 933 SharedQuadState* shared_quad_state = |
| 934 quad_sink.UseSharedQuadState(SharedQuadState::Create()); | 934 quad_sink.UseSharedQuadState(SharedQuadState::Create()); |
| 935 shared_quad_state->SetAll(root_pass_transform, | 935 shared_quad_state->SetAll(root_pass_transform, |
| 936 root_pass_content_bounds, | 936 root_pass_content_bounds, |
| 937 root_pass_rect, | 937 root_pass_rect, |
| 938 root_pass_clip_rect, | 938 root_pass_clip_rect, |
| 939 root_pass_clipped, | 939 root_pass_clipped, |
| 940 1.f); | 940 1.f, |
| 941 SkXfermode::kSrcOver_Mode); |
| 941 | 942 |
| 942 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 943 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 943 RenderPassDrawQuad::Create(); | 944 RenderPassDrawQuad::Create(); |
| 944 render_pass_quad->SetNew( | 945 render_pass_quad->SetNew( |
| 945 shared_quad_state, | 946 shared_quad_state, |
| 946 gfx::Rect(5, 5, 7, 7), // rect | 947 gfx::Rect(5, 5, 7, 7), // rect |
| 947 RenderPass::Id(10, 7), // render_pass_id | 948 RenderPass::Id(10, 7), // render_pass_id |
| 948 false, // is_replica | 949 false, // is_replica |
| 949 0, // mask_resource_id | 950 0, // mask_resource_id |
| 950 child_pass_rect, // contents_changed_since_last_frame | 951 child_pass_rect, // contents_changed_since_last_frame |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 1292 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| 1292 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 1293 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
| 1293 frame.render_passes[0]->quad_list[0]->material); | 1294 frame.render_passes[0]->quad_list[0]->material); |
| 1294 | 1295 |
| 1295 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 1296 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 1296 host_impl_->DidDrawAllLayers(frame); | 1297 host_impl_->DidDrawAllLayers(frame); |
| 1297 } | 1298 } |
| 1298 | 1299 |
| 1299 } // namespace | 1300 } // namespace |
| 1300 } // namespace cc | 1301 } // namespace cc |
| OLD | NEW |