| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 3680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3691 bool tile_is_visible = | 3691 bool tile_is_visible = |
| 3692 tile->content_rect().Intersects(pending_layer()->visible_layer_rect()); | 3692 tile->content_rect().Intersects(pending_layer()->visible_layer_rect()); |
| 3693 if (tile_is_visible) | 3693 if (tile_is_visible) |
| 3694 unoccluded_tile_count++; | 3694 unoccluded_tile_count++; |
| 3695 queue->Pop(); | 3695 queue->Pop(); |
| 3696 } | 3696 } |
| 3697 EXPECT_EQ(unoccluded_tile_count, 25); | 3697 EXPECT_EQ(unoccluded_tile_count, 25); |
| 3698 | 3698 |
| 3699 // Partial occlusion. | 3699 // Partial occlusion. |
| 3700 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); | 3700 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); |
| 3701 LayerImpl* layer1 = pending_layer()->children()[0]; | 3701 LayerImpl* layer1 = pending_layer()->test_properties()->children[0]; |
| 3702 layer1->SetBounds(layer_bounds); | 3702 layer1->SetBounds(layer_bounds); |
| 3703 layer1->SetDrawsContent(true); | 3703 layer1->SetDrawsContent(true); |
| 3704 layer1->SetContentsOpaque(true); | 3704 layer1->SetContentsOpaque(true); |
| 3705 layer1->SetPosition(occluding_layer_position); | 3705 layer1->SetPosition(occluding_layer_position); |
| 3706 | 3706 |
| 3707 RebuildPropertyTreesOnPendingTree(); | 3707 RebuildPropertyTreesOnPendingTree(); |
| 3708 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); | 3708 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); |
| 3709 bool update_lcd_text = false; | 3709 bool update_lcd_text = false; |
| 3710 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); | 3710 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 3711 | 3711 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3786 if (prioritized_tiles[tile].is_occluded()) { | 3786 if (prioritized_tiles[tile].is_occluded()) { |
| 3787 EXPECT_FALSE(tile->required_for_activation()); | 3787 EXPECT_FALSE(tile->required_for_activation()); |
| 3788 occluded_tile_count++; | 3788 occluded_tile_count++; |
| 3789 } | 3789 } |
| 3790 } | 3790 } |
| 3791 EXPECT_EQ(occluded_tile_count, 0); | 3791 EXPECT_EQ(occluded_tile_count, 0); |
| 3792 } | 3792 } |
| 3793 | 3793 |
| 3794 // Partial occlusion. | 3794 // Partial occlusion. |
| 3795 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); | 3795 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); |
| 3796 LayerImpl* layer1 = pending_layer()->children()[0]; | 3796 LayerImpl* layer1 = pending_layer()->test_properties()->children[0]; |
| 3797 layer1->SetBounds(layer_bounds); | 3797 layer1->SetBounds(layer_bounds); |
| 3798 layer1->SetDrawsContent(true); | 3798 layer1->SetDrawsContent(true); |
| 3799 layer1->SetContentsOpaque(true); | 3799 layer1->SetContentsOpaque(true); |
| 3800 layer1->SetPosition(occluding_layer_position); | 3800 layer1->SetPosition(occluding_layer_position); |
| 3801 | 3801 |
| 3802 RebuildPropertyTreesOnPendingTree(); | 3802 RebuildPropertyTreesOnPendingTree(); |
| 3803 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); | 3803 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); |
| 3804 bool update_lcd_text = false; | 3804 bool update_lcd_text = false; |
| 3805 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); | 3805 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 3806 | 3806 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 | 3883 |
| 3884 scoped_refptr<FakeRasterSource> pending_raster_source = | 3884 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 3885 FakeRasterSource::CreateFilled(layer_bounds); | 3885 FakeRasterSource::CreateFilled(layer_bounds); |
| 3886 | 3886 |
| 3887 host_impl()->SetViewportSize(viewport_size); | 3887 host_impl()->SetViewportSize(viewport_size); |
| 3888 | 3888 |
| 3889 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); | 3889 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); |
| 3890 ASSERT_TRUE(pending_layer()->CanHaveTilings()); | 3890 ASSERT_TRUE(pending_layer()->CanHaveTilings()); |
| 3891 | 3891 |
| 3892 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); | 3892 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 1)); |
| 3893 LayerImpl* layer1 = pending_layer()->children()[0]; | 3893 LayerImpl* layer1 = pending_layer()->test_properties()->children[0]; |
| 3894 layer1->SetBounds(layer_bounds); | 3894 layer1->SetBounds(layer_bounds); |
| 3895 layer1->SetDrawsContent(true); | 3895 layer1->SetDrawsContent(true); |
| 3896 layer1->SetContentsOpaque(true); | 3896 layer1->SetContentsOpaque(true); |
| 3897 layer1->SetPosition(occluding_layer_position); | 3897 layer1->SetPosition(occluding_layer_position); |
| 3898 | 3898 |
| 3899 pending_layer()->tilings()->RemoveAllTilings(); | 3899 pending_layer()->tilings()->RemoveAllTilings(); |
| 3900 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; | 3900 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
| 3901 pending_layer()->AddTiling(low_res_factor)->set_resolution(LOW_RESOLUTION); | 3901 pending_layer()->AddTiling(low_res_factor)->set_resolution(LOW_RESOLUTION); |
| 3902 pending_layer()->AddTiling(0.3f)->set_resolution(HIGH_RESOLUTION); | 3902 pending_layer()->AddTiling(0.3f)->set_resolution(HIGH_RESOLUTION); |
| 3903 pending_layer()->AddTiling(0.7f)->set_resolution(HIGH_RESOLUTION); | 3903 pending_layer()->AddTiling(0.7f)->set_resolution(HIGH_RESOLUTION); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3958 scoped_refptr<FakeRasterSource> pending_raster_source = | 3958 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 3959 FakeRasterSource::CreateFilled(layer_bounds); | 3959 FakeRasterSource::CreateFilled(layer_bounds); |
| 3960 scoped_refptr<FakeRasterSource> active_raster_source = | 3960 scoped_refptr<FakeRasterSource> active_raster_source = |
| 3961 FakeRasterSource::CreateFilled(layer_bounds); | 3961 FakeRasterSource::CreateFilled(layer_bounds); |
| 3962 | 3962 |
| 3963 host_impl()->SetViewportSize(viewport_size); | 3963 host_impl()->SetViewportSize(viewport_size); |
| 3964 SetupPendingTree(active_raster_source); | 3964 SetupPendingTree(active_raster_source); |
| 3965 | 3965 |
| 3966 // Partially occlude the active layer. | 3966 // Partially occlude the active layer. |
| 3967 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 2)); | 3967 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 2)); |
| 3968 LayerImpl* layer1 = pending_layer()->children()[0]; | 3968 LayerImpl* layer1 = pending_layer()->test_properties()->children[0]; |
| 3969 layer1->SetBounds(layer_bounds); | 3969 layer1->SetBounds(layer_bounds); |
| 3970 layer1->SetDrawsContent(true); | 3970 layer1->SetDrawsContent(true); |
| 3971 layer1->SetContentsOpaque(true); | 3971 layer1->SetContentsOpaque(true); |
| 3972 layer1->SetPosition(occluding_layer_position); | 3972 layer1->SetPosition(occluding_layer_position); |
| 3973 | 3973 |
| 3974 ActivateTree(); | 3974 ActivateTree(); |
| 3975 | 3975 |
| 3976 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { | 3976 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { |
| 3977 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); | 3977 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); |
| 3978 auto prioritized_tiles = | 3978 auto prioritized_tiles = |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4052 | 4052 |
| 4053 scoped_refptr<FakeRasterSource> pending_raster_source = | 4053 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 4054 FakeRasterSource::CreateFilled(layer_bounds); | 4054 FakeRasterSource::CreateFilled(layer_bounds); |
| 4055 scoped_refptr<FakeRasterSource> active_raster_source = | 4055 scoped_refptr<FakeRasterSource> active_raster_source = |
| 4056 FakeRasterSource::CreateFilled(layer_bounds); | 4056 FakeRasterSource::CreateFilled(layer_bounds); |
| 4057 | 4057 |
| 4058 SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region()); | 4058 SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region()); |
| 4059 | 4059 |
| 4060 // Partially occlude the active layer. | 4060 // Partially occlude the active layer. |
| 4061 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 2)); | 4061 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 2)); |
| 4062 LayerImpl* active_occluding_layer = pending_layer()->children()[0]; | 4062 LayerImpl* active_occluding_layer = |
| 4063 pending_layer()->test_properties()->children[0]; |
| 4063 active_occluding_layer->SetBounds(layer_bounds); | 4064 active_occluding_layer->SetBounds(layer_bounds); |
| 4064 active_occluding_layer->SetDrawsContent(true); | 4065 active_occluding_layer->SetDrawsContent(true); |
| 4065 active_occluding_layer->SetContentsOpaque(true); | 4066 active_occluding_layer->SetContentsOpaque(true); |
| 4066 active_occluding_layer->SetPosition(active_occluding_layer_position); | 4067 active_occluding_layer->SetPosition(active_occluding_layer_position); |
| 4067 | 4068 |
| 4068 ActivateTree(); | 4069 ActivateTree(); |
| 4069 | 4070 |
| 4070 // Partially invalidate the pending layer. Tiles inside the invalidation rect | 4071 // Partially invalidate the pending layer. Tiles inside the invalidation rect |
| 4071 // are created. | 4072 // are created. |
| 4072 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, | 4073 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, |
| 4073 invalidation_rect); | 4074 invalidation_rect); |
| 4074 | 4075 |
| 4075 // Partially occlude the pending layer in a different way. | 4076 // Partially occlude the pending layer in a different way. |
| 4076 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 3)); | 4077 pending_layer()->AddChild(LayerImpl::Create(host_impl()->pending_tree(), 3)); |
| 4077 LayerImpl* pending_occluding_layer = pending_layer()->children()[0]; | 4078 LayerImpl* pending_occluding_layer = |
| 4079 pending_layer()->test_properties()->children[0]; |
| 4078 pending_occluding_layer->SetBounds(layer_bounds); | 4080 pending_occluding_layer->SetBounds(layer_bounds); |
| 4079 pending_occluding_layer->SetDrawsContent(true); | 4081 pending_occluding_layer->SetDrawsContent(true); |
| 4080 pending_occluding_layer->SetContentsOpaque(true); | 4082 pending_occluding_layer->SetContentsOpaque(true); |
| 4081 pending_occluding_layer->SetPosition(pending_occluding_layer_position); | 4083 pending_occluding_layer->SetPosition(pending_occluding_layer_position); |
| 4082 | 4084 |
| 4083 EXPECT_EQ(1u, pending_layer()->num_tilings()); | 4085 EXPECT_EQ(1u, pending_layer()->num_tilings()); |
| 4084 EXPECT_EQ(2u, active_layer()->num_tilings()); | 4086 EXPECT_EQ(2u, active_layer()->num_tilings()); |
| 4085 | 4087 |
| 4086 RebuildPropertyTreesOnPendingTree(); | 4088 RebuildPropertyTreesOnPendingTree(); |
| 4087 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4089 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4763 // New low res tiling. | 4765 // New low res tiling. |
| 4764 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 4766 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
| 4765 | 4767 |
| 4766 // This tiling will be high res now, it won't contain low res content since it | 4768 // This tiling will be high res now, it won't contain low res content since it |
| 4767 // was all destroyed. | 4769 // was all destroyed. |
| 4768 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 4770 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
| 4769 } | 4771 } |
| 4770 | 4772 |
| 4771 } // namespace | 4773 } // namespace |
| 4772 } // namespace cc | 4774 } // namespace cc |
| OLD | NEW |