| 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/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
| 9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
| 10 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
| 11 #include "cc/quads/surface_draw_quad.h" | 11 #include "cc/quads/surface_draw_quad.h" |
| 12 #include "cc/test/compositor_frame_helpers.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 namespace test { | 15 namespace test { |
| 15 | 16 |
| 16 void CreateSharedQuadState(RenderPass* pass, | 17 void CreateSharedQuadState(RenderPass* pass, |
| 17 const gfx::Transform& transform, | 18 const gfx::Transform& transform, |
| 18 const gfx::Rect& root_rect) { | 19 const gfx::Rect& root_rect) { |
| 19 SharedQuadState* child_shared_state = pass->CreateAndAppendSharedQuadState(); | 20 SharedQuadState* child_shared_state = pass->CreateAndAppendSharedQuadState(); |
| 20 child_shared_state->SetAll(transform, root_rect, root_rect, root_rect, false, | 21 child_shared_state->SetAll(transform, root_rect, root_rect, root_rect, false, |
| 21 1.0f, SkBlendMode::kSrcOver, 0); | 22 1.0f, SkBlendMode::kSrcOver, 0); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const gfx::Rect& rect, | 64 const gfx::Rect& rect, |
| 64 const gfx::Transform& transform_to_root_target, | 65 const gfx::Transform& transform_to_root_target, |
| 65 RenderPassList* render_pass_list) { | 66 RenderPassList* render_pass_list) { |
| 66 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); | 67 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 67 render_pass->SetNew(render_pass_id, rect, rect, transform_to_root_target); | 68 render_pass->SetNew(render_pass_id, rect, rect, transform_to_root_target); |
| 68 render_pass_list->push_back(std::move(render_pass)); | 69 render_pass_list->push_back(std::move(render_pass)); |
| 69 } | 70 } |
| 70 | 71 |
| 71 CompositorFrame CreateCompositorFrame(const gfx::Rect& root_rect, | 72 CompositorFrame CreateCompositorFrame(const gfx::Rect& root_rect, |
| 72 RenderPass** render_pass) { | 73 RenderPass** render_pass) { |
| 73 CompositorFrame root_frame; | 74 CompositorFrame root_frame = test::MakeCompositorFrame(); |
| 74 int root_id = 1; | 75 int root_id = 1; |
| 75 CreateRenderPass(root_id, root_rect, gfx::Transform(), | 76 CreateRenderPass(root_id, root_rect, gfx::Transform(), |
| 76 &root_frame.render_pass_list); | 77 &root_frame.render_pass_list); |
| 77 *render_pass = root_frame.render_pass_list.back().get(); | 78 *render_pass = root_frame.render_pass_list.back().get(); |
| 78 return root_frame; | 79 return root_frame; |
| 79 } | 80 } |
| 80 | 81 |
| 81 TestSurfaceHittestDelegate::TestSurfaceHittestDelegate() | 82 TestSurfaceHittestDelegate::TestSurfaceHittestDelegate() |
| 82 : reject_target_overrides_(0), accept_target_overrides_(0) {} | 83 : reject_target_overrides_(0), accept_target_overrides_(0) {} |
| 83 | 84 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // If the point provided falls outside the inset, then we accept this surface. | 122 // If the point provided falls outside the inset, then we accept this surface. |
| 122 if (!bounds.Contains(point_in_quad_space)) { | 123 if (!bounds.Contains(point_in_quad_space)) { |
| 123 ++accept_target_overrides_; | 124 ++accept_target_overrides_; |
| 124 return true; | 125 return true; |
| 125 } | 126 } |
| 126 return false; | 127 return false; |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace test | 130 } // namespace test |
| 130 } // namespace cc | 131 } // namespace cc |
| OLD | NEW |