| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/surface_hittest_test_helpers.h" | 5 #include "cc/test/surface_hittest_test_helpers.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/delegated_frame_data.h" | |
| 9 #include "cc/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
| 10 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
| 11 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
| 12 #include "cc/quads/surface_draw_quad.h" | 11 #include "cc/quads/surface_draw_quad.h" |
| 13 | 12 |
| 14 namespace cc { | 13 namespace cc { |
| 15 namespace test { | 14 namespace test { |
| 16 | 15 |
| 17 void CreateSharedQuadState(RenderPass* pass, | 16 void CreateSharedQuadState(RenderPass* pass, |
| 18 const gfx::Transform& transform, | 17 const gfx::Transform& transform, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 60 |
| 62 void CreateRenderPass(const RenderPassId& render_pass_id, | 61 void CreateRenderPass(const RenderPassId& render_pass_id, |
| 63 const gfx::Rect& rect, | 62 const gfx::Rect& rect, |
| 64 const gfx::Transform& transform_to_root_target, | 63 const gfx::Transform& transform_to_root_target, |
| 65 RenderPassList* render_pass_list) { | 64 RenderPassList* render_pass_list) { |
| 66 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); | 65 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 67 render_pass->SetNew(render_pass_id, rect, rect, transform_to_root_target); | 66 render_pass->SetNew(render_pass_id, rect, rect, transform_to_root_target); |
| 68 render_pass_list->push_back(std::move(render_pass)); | 67 render_pass_list->push_back(std::move(render_pass)); |
| 69 } | 68 } |
| 70 | 69 |
| 71 CompositorFrame CreateCompositorFrameWithRenderPassList( | |
| 72 RenderPassList* render_pass_list) { | |
| 73 std::unique_ptr<DelegatedFrameData> root_delegated_frame_data( | |
| 74 new DelegatedFrameData); | |
| 75 root_delegated_frame_data->render_pass_list.swap(*render_pass_list); | |
| 76 CompositorFrame root_frame; | |
| 77 root_frame.delegated_frame_data = std::move(root_delegated_frame_data); | |
| 78 return root_frame; | |
| 79 } | |
| 80 | |
| 81 CompositorFrame CreateCompositorFrame(const gfx::Rect& root_rect, | 70 CompositorFrame CreateCompositorFrame(const gfx::Rect& root_rect, |
| 82 RenderPass** render_pass) { | 71 RenderPass** render_pass) { |
| 83 RenderPassList render_pass_list; | 72 CompositorFrame root_frame; |
| 84 RenderPassId root_id(1, 1); | 73 RenderPassId root_id(1, 1); |
| 85 CreateRenderPass(root_id, root_rect, gfx::Transform(), &render_pass_list); | 74 CreateRenderPass(root_id, root_rect, gfx::Transform(), |
| 86 | 75 &root_frame.render_pass_list); |
| 87 CompositorFrame root_frame = | 76 *render_pass = root_frame.render_pass_list.back().get(); |
| 88 CreateCompositorFrameWithRenderPassList(&render_pass_list); | |
| 89 | |
| 90 *render_pass = root_frame.delegated_frame_data->render_pass_list.back().get(); | |
| 91 return root_frame; | 77 return root_frame; |
| 92 } | 78 } |
| 93 | 79 |
| 94 TestSurfaceHittestDelegate::TestSurfaceHittestDelegate() | 80 TestSurfaceHittestDelegate::TestSurfaceHittestDelegate() |
| 95 : reject_target_overrides_(0), accept_target_overrides_(0) {} | 81 : reject_target_overrides_(0), accept_target_overrides_(0) {} |
| 96 | 82 |
| 97 TestSurfaceHittestDelegate::~TestSurfaceHittestDelegate() {} | 83 TestSurfaceHittestDelegate::~TestSurfaceHittestDelegate() {} |
| 98 | 84 |
| 99 void TestSurfaceHittestDelegate::AddInsetsForRejectSurface( | 85 void TestSurfaceHittestDelegate::AddInsetsForRejectSurface( |
| 100 const SurfaceId& surface_id, | 86 const SurfaceId& surface_id, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // If the point provided falls outside the inset, then we accept this surface. | 120 // If the point provided falls outside the inset, then we accept this surface. |
| 135 if (!bounds.Contains(point_in_quad_space)) { | 121 if (!bounds.Contains(point_in_quad_space)) { |
| 136 ++accept_target_overrides_; | 122 ++accept_target_overrides_; |
| 137 return true; | 123 return true; |
| 138 } | 124 } |
| 139 return false; | 125 return false; |
| 140 } | 126 } |
| 141 | 127 |
| 142 } // namespace test | 128 } // namespace test |
| 143 } // namespace cc | 129 } // namespace cc |
| OLD | NEW |