| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3456 // This test verifies that only SurfaceLayers in the viewport are included | 3456 // This test verifies that only SurfaceLayers in the viewport are included |
| 3457 // in CompositorFrameMetadata's |activation_dependencies|. | 3457 // in CompositorFrameMetadata's |activation_dependencies|. |
| 3458 TEST_F(LayerTreeHostImplTest, EmbeddedSurfacesInMetadata) { | 3458 TEST_F(LayerTreeHostImplTest, EmbeddedSurfacesInMetadata) { |
| 3459 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 3459 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 3460 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 3460 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 3461 LayerImpl* root = host_impl_->active_tree()->root_layer_for_testing(); | 3461 LayerImpl* root = host_impl_->active_tree()->root_layer_for_testing(); |
| 3462 | 3462 |
| 3463 std::vector<SurfaceId> children = {MakeSurfaceId(FrameSinkId(1, 1), 1), | 3463 std::vector<SurfaceId> children = {MakeSurfaceId(FrameSinkId(1, 1), 1), |
| 3464 MakeSurfaceId(FrameSinkId(2, 2), 2), | 3464 MakeSurfaceId(FrameSinkId(2, 2), 2), |
| 3465 MakeSurfaceId(FrameSinkId(3, 3), 3)}; | 3465 MakeSurfaceId(FrameSinkId(3, 3), 3)}; |
| 3466 base::flat_set<SurfaceId> children_set; |
| 3466 for (size_t i = 0; i < children.size(); ++i) { | 3467 for (size_t i = 0; i < children.size(); ++i) { |
| 3468 children_set.insert(children[i]); |
| 3467 std::unique_ptr<SurfaceLayerImpl> child = | 3469 std::unique_ptr<SurfaceLayerImpl> child = |
| 3468 SurfaceLayerImpl::Create(host_impl_->active_tree(), i + 6); | 3470 SurfaceLayerImpl::Create(host_impl_->active_tree(), i + 6); |
| 3469 child->SetPosition(gfx::PointF(25.f * i, 0.f)); | 3471 child->SetPosition(gfx::PointF(25.f * i, 0.f)); |
| 3470 child->SetBounds(gfx::Size(1, 1)); | 3472 child->SetBounds(gfx::Size(1, 1)); |
| 3471 child->SetDrawsContent(true); | 3473 child->SetDrawsContent(true); |
| 3472 child->SetPrimarySurfaceInfo( | 3474 child->SetPrimarySurfaceInfo( |
| 3473 SurfaceInfo(children[i], 1.f /* device_scale_factor */, | 3475 SurfaceInfo(children[i], 1.f /* device_scale_factor */, |
| 3474 gfx::Size(10, 10) /* size_in_pixels */)); | 3476 gfx::Size(10, 10) /* size_in_pixels */)); |
| 3475 root->test_properties()->AddChild(std::move(child)); | 3477 root->test_properties()->AddChild(std::move(child)); |
| 3476 } | 3478 } |
| 3477 | 3479 |
| 3478 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 3480 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 3481 host_impl_->active_tree()->SetSurfaceLayerIds(children_set); |
| 3479 DrawFrame(); | 3482 DrawFrame(); |
| 3480 | 3483 |
| 3481 FakeCompositorFrameSink* fake_compositor_frame_sink = | 3484 FakeCompositorFrameSink* fake_compositor_frame_sink = |
| 3482 static_cast<FakeCompositorFrameSink*>( | 3485 static_cast<FakeCompositorFrameSink*>( |
| 3483 host_impl_->compositor_frame_sink()); | 3486 host_impl_->compositor_frame_sink()); |
| 3484 const CompositorFrameMetadata& metadata = | 3487 const CompositorFrameMetadata& metadata = |
| 3485 fake_compositor_frame_sink->last_sent_frame()->metadata; | 3488 fake_compositor_frame_sink->last_sent_frame()->metadata; |
| 3486 EXPECT_THAT(metadata.activation_dependencies, | 3489 EXPECT_THAT(metadata.activation_dependencies, |
| 3487 testing::UnorderedElementsAre(children[0], children[1])); | 3490 testing::UnorderedElementsAre(children[0], children[1])); |
| 3488 EXPECT_THAT( | 3491 EXPECT_THAT( |
| (...skipping 8902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12391 | 12394 |
| 12392 TEST_F(LayerTreeHostImplTest, RasterColorSpace) { | 12395 TEST_F(LayerTreeHostImplTest, RasterColorSpace) { |
| 12393 LayerTreeSettings settings = DefaultSettings(); | 12396 LayerTreeSettings settings = DefaultSettings(); |
| 12394 settings.enable_color_correct_rasterization = true; | 12397 settings.enable_color_correct_rasterization = true; |
| 12395 CreateHostImpl(settings, CreateCompositorFrameSink()); | 12398 CreateHostImpl(settings, CreateCompositorFrameSink()); |
| 12396 EXPECT_EQ(host_impl_->GetRasterColorSpace(), gfx::ColorSpace::CreateSRGB()); | 12399 EXPECT_EQ(host_impl_->GetRasterColorSpace(), gfx::ColorSpace::CreateSRGB()); |
| 12397 } | 12400 } |
| 12398 | 12401 |
| 12399 } // namespace | 12402 } // namespace |
| 12400 } // namespace cc | 12403 } // namespace cc |
| OLD | NEW |