| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
| 10 #include "cc/surfaces/surface_factory_client.h" | 10 #include "cc/surfaces/surface_factory_client.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 | 391 |
| 392 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) { | 392 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) { |
| 393 SurfaceManager manager; | 393 SurfaceManager manager; |
| 394 EmptySurfaceFactoryClient client; | 394 EmptySurfaceFactoryClient client; |
| 395 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); | 395 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); |
| 396 SurfaceFactory factory(root_frame_sink_id, &manager, &client); | 396 SurfaceFactory factory(root_frame_sink_id, &manager, &client); |
| 397 | 397 |
| 398 // Create a CompostiorFrame with two RenderPasses. | 398 // Create a CompostiorFrame with two RenderPasses. |
| 399 gfx::Rect root_rect(300, 300); | 399 gfx::Rect root_rect(300, 300); |
| 400 RenderPassList render_pass_list; | 400 CompositorFrame root_frame; |
| 401 RenderPassList& render_pass_list = root_frame.render_pass_list; |
| 401 | 402 |
| 402 // Create a child RenderPass. | 403 // Create a child RenderPass. |
| 403 RenderPassId child_render_pass_id(1, 3); | 404 RenderPassId child_render_pass_id(1, 3); |
| 404 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f, | 405 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f, |
| 405 0.0f, 1.0f, 0.0f, 50.0f, | 406 0.0f, 1.0f, 0.0f, 50.0f, |
| 406 0.0f, 0.0f, 1.0f, 0.0f, | 407 0.0f, 0.0f, 1.0f, 0.0f, |
| 407 0.0f, 0.0f, 0.0f, 1.0f); | 408 0.0f, 0.0f, 0.0f, 1.0f); |
| 408 CreateRenderPass(child_render_pass_id, | 409 CreateRenderPass(child_render_pass_id, |
| 409 gfx::Rect(100, 100), | 410 gfx::Rect(100, 100), |
| 410 transform_to_root_target, | 411 transform_to_root_target, |
| 411 &render_pass_list); | 412 &render_pass_list); |
| 412 | 413 |
| 413 // Create the root RenderPass. | 414 // Create the root RenderPass. |
| 414 RenderPassId root_render_pass_id(1, 2); | 415 RenderPassId root_render_pass_id(1, 2); |
| 415 CreateRenderPass(root_render_pass_id, root_rect, gfx::Transform(), | 416 CreateRenderPass(root_render_pass_id, root_rect, gfx::Transform(), |
| 416 &render_pass_list); | 417 &render_pass_list); |
| 417 | 418 |
| 418 RenderPass* root_pass = nullptr; | 419 RenderPass* root_pass = nullptr; |
| 419 CompositorFrame root_frame = | 420 root_pass = root_frame.render_pass_list.back().get(); |
| 420 CreateCompositorFrameWithRenderPassList(&render_pass_list); | |
| 421 root_pass = root_frame.delegated_frame_data->render_pass_list.back().get(); | |
| 422 | 421 |
| 423 // Create a RenderPassDrawQuad. | 422 // Create a RenderPassDrawQuad. |
| 424 gfx::Rect render_pass_quad_rect(100, 100); | 423 gfx::Rect render_pass_quad_rect(100, 100); |
| 425 CreateRenderPassDrawQuad(root_pass, | 424 CreateRenderPassDrawQuad(root_pass, |
| 426 transform_to_root_target, | 425 transform_to_root_target, |
| 427 root_rect, | 426 root_rect, |
| 428 render_pass_quad_rect, | 427 render_pass_quad_rect, |
| 429 child_render_pass_id); | 428 child_render_pass_id); |
| 430 | 429 |
| 431 // Add a solid quad in the child render pass. | 430 // Add a solid quad in the child render pass. |
| 432 RenderPass* child_render_pass = | 431 RenderPass* child_render_pass = root_frame.render_pass_list.front().get(); |
| 433 root_frame.delegated_frame_data->render_pass_list.front().get(); | |
| 434 gfx::Rect child_solid_quad_rect(100, 100); | 432 gfx::Rect child_solid_quad_rect(100, 100); |
| 435 CreateSolidColorDrawQuad(child_render_pass, | 433 CreateSolidColorDrawQuad(child_render_pass, |
| 436 gfx::Transform(), | 434 gfx::Transform(), |
| 437 gfx::Rect(100, 100), | 435 gfx::Rect(100, 100), |
| 438 child_solid_quad_rect); | 436 child_solid_quad_rect); |
| 439 | 437 |
| 440 // Submit the root frame. | 438 // Submit the root frame. |
| 441 SurfaceIdAllocator root_allocator; | 439 SurfaceIdAllocator root_allocator; |
| 442 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 440 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); |
| 443 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 441 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 | 624 |
| 627 // Verify that insets have affected hit targeting. | 625 // Verify that insets have affected hit targeting. |
| 628 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); | 626 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); |
| 629 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); | 627 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); |
| 630 | 628 |
| 631 root_factory.Destroy(root_local_frame_id); | 629 root_factory.Destroy(root_local_frame_id); |
| 632 child_factory.Destroy(child_local_frame_id); | 630 child_factory.Destroy(child_local_frame_id); |
| 633 } | 631 } |
| 634 | 632 |
| 635 } // namespace cc | 633 } // namespace cc |
| OLD | NEW |