| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_aggregator_test_helpers.h" | 5 #include "cc/surfaces/surface_aggregator_test_helpers.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| 11 #include "cc/output/delegated_frame_data.h" | 11 #include "cc/output/delegated_frame_data.h" |
| 12 #include "cc/quads/render_pass_draw_quad.h" | 12 #include "cc/quads/render_pass_draw_quad.h" |
| 13 #include "cc/quads/shared_quad_state.h" | 13 #include "cc/quads/shared_quad_state.h" |
| 14 #include "cc/quads/solid_color_draw_quad.h" | 14 #include "cc/quads/solid_color_draw_quad.h" |
| 15 #include "cc/quads/surface_draw_quad.h" | 15 #include "cc/quads/surface_draw_quad.h" |
| 16 #include "cc/surfaces/surface.h" | 16 #include "cc/surfaces/surface.h" |
| 17 #include "cc/test/mock_quad_culler.h" | |
| 18 #include "cc/test/render_pass_test_common.h" | 17 #include "cc/test/render_pass_test_common.h" |
| 19 #include "cc/test/render_pass_test_utils.h" | 18 #include "cc/test/render_pass_test_utils.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/skia/include/core/SkXfermode.h" | 20 #include "third_party/skia/include/core/SkXfermode.h" |
| 22 | 21 |
| 23 namespace cc { | 22 namespace cc { |
| 24 namespace test { | 23 namespace test { |
| 25 | 24 |
| 26 void AddTestSurfaceQuad(TestRenderPass* pass, | 25 void AddTestSurfaceQuad(TestRenderPass* pass, |
| 27 const gfx::Size& surface_size, | 26 const gfx::Size& surface_size, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 scoped_ptr<SurfaceDrawQuad> surface_quad = SurfaceDrawQuad::Create(); | 45 scoped_ptr<SurfaceDrawQuad> surface_quad = SurfaceDrawQuad::Create(); |
| 47 gfx::Rect quad_rect = gfx::Rect(surface_size); | 46 gfx::Rect quad_rect = gfx::Rect(surface_size); |
| 48 surface_quad->SetNew(pass->shared_quad_state_list.back(), | 47 surface_quad->SetNew(pass->shared_quad_state_list.back(), |
| 49 gfx::Rect(surface_size), | 48 gfx::Rect(surface_size), |
| 50 gfx::Rect(surface_size), | 49 gfx::Rect(surface_size), |
| 51 surface_id); | 50 surface_id); |
| 52 pass->quad_list.push_back(surface_quad.PassAs<DrawQuad>()); | 51 pass->quad_list.push_back(surface_quad.PassAs<DrawQuad>()); |
| 53 } | 52 } |
| 54 void AddTestRenderPassQuad(TestRenderPass* pass, | 53 void AddTestRenderPassQuad(TestRenderPass* pass, |
| 55 RenderPass::Id render_pass_id) { | 54 RenderPass::Id render_pass_id) { |
| 56 MockQuadCuller quad_sink(pass); | |
| 57 gfx::Rect output_rect = gfx::Rect(0, 0, 5, 5); | 55 gfx::Rect output_rect = gfx::Rect(0, 0, 5, 5); |
| 58 SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); | 56 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); |
| 59 shared_state->SetAll(gfx::Transform(), | 57 shared_state->SetAll(gfx::Transform(), |
| 60 output_rect.size(), | 58 output_rect.size(), |
| 61 output_rect, | 59 output_rect, |
| 62 output_rect, | 60 output_rect, |
| 63 false, | 61 false, |
| 64 1, | 62 1, |
| 65 SkXfermode::kSrcOver_Mode); | 63 SkXfermode::kSrcOver_Mode); |
| 66 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); | 64 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); |
| 67 quad->SetNew(shared_state, | 65 quad->SetNew(shared_state, |
| 68 output_rect, | 66 output_rect, |
| 69 output_rect, | 67 output_rect, |
| 70 render_pass_id, | 68 render_pass_id, |
| 71 false, | 69 false, |
| 72 0, | 70 0, |
| 73 output_rect, | 71 output_rect, |
| 74 gfx::RectF(), | 72 gfx::RectF(), |
| 75 FilterOperations(), | 73 FilterOperations(), |
| 76 FilterOperations()); | 74 FilterOperations()); |
| 77 quad_sink.Append(quad.PassAs<DrawQuad>()); | 75 pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); |
| 78 } | 76 } |
| 79 | 77 |
| 80 void AddQuadInPass(TestRenderPass* pass, Quad desc) { | 78 void AddQuadInPass(TestRenderPass* pass, Quad desc) { |
| 81 switch (desc.material) { | 79 switch (desc.material) { |
| 82 case DrawQuad::SOLID_COLOR: | 80 case DrawQuad::SOLID_COLOR: |
| 83 AddQuad(pass, gfx::Rect(0, 0, 5, 5), desc.color); | 81 AddQuad(pass, gfx::Rect(0, 0, 5, 5), desc.color); |
| 84 break; | 82 break; |
| 85 case DrawQuad::SURFACE_CONTENT: | 83 case DrawQuad::SURFACE_CONTENT: |
| 86 AddTestSurfaceQuad(pass, gfx::Size(5, 5), desc.surface_id); | 84 AddTestSurfaceQuad(pass, gfx::Size(5, 5), desc.surface_id); |
| 87 break; | 85 break; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 161 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 164 | 162 |
| 165 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 163 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 166 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 164 child_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 167 | 165 |
| 168 surface->QueueFrame(child_frame.Pass()); | 166 surface->QueueFrame(child_frame.Pass()); |
| 169 } | 167 } |
| 170 | 168 |
| 171 } // namespace test | 169 } // namespace test |
| 172 } // namespace cc | 170 } // namespace cc |
| OLD | NEW |