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