| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 4626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4637 host->SetRootLayer(layer); | 4637 host->SetRootLayer(layer); |
| 4638 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4638 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
| 4639 | 4639 |
| 4640 int frame_number = 0; | 4640 int frame_number = 0; |
| 4641 | 4641 |
| 4642 client.set_fill_with_nonsolid_color(!test_for_solid); | 4642 client.set_fill_with_nonsolid_color(!test_for_solid); |
| 4643 | 4643 |
| 4644 Region invalidation(layer_rect); | 4644 Region invalidation(layer_rect); |
| 4645 recording_source->UpdateAndExpandInvalidation( | 4645 recording_source->UpdateAndExpandInvalidation( |
| 4646 &client, &invalidation, false, layer_bounds, layer_rect, frame_number++, | 4646 &client, &invalidation, false, layer_bounds, layer_rect, frame_number++, |
| 4647 Picture::RECORD_NORMALLY); | 4647 RecordingSource::RECORD_NORMALLY); |
| 4648 | 4648 |
| 4649 scoped_refptr<RasterSource> pending_raster_source = | 4649 scoped_refptr<RasterSource> pending_raster_source = |
| 4650 recording_source->CreateRasterSource(); | 4650 recording_source->CreateRasterSource(); |
| 4651 | 4651 |
| 4652 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); | 4652 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); |
| 4653 ActivateTree(); | 4653 ActivateTree(); |
| 4654 | 4654 |
| 4655 if (test_for_solid) { | 4655 if (test_for_solid) { |
| 4656 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4656 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4657 } else { | 4657 } else { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4700 host->SetRootLayer(layer); | 4700 host->SetRootLayer(layer); |
| 4701 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4701 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
| 4702 | 4702 |
| 4703 int frame_number = 0; | 4703 int frame_number = 0; |
| 4704 | 4704 |
| 4705 client.set_fill_with_nonsolid_color(true); | 4705 client.set_fill_with_nonsolid_color(true); |
| 4706 | 4706 |
| 4707 Region invalidation1(layer_rect); | 4707 Region invalidation1(layer_rect); |
| 4708 recording_source->UpdateAndExpandInvalidation( | 4708 recording_source->UpdateAndExpandInvalidation( |
| 4709 &client, &invalidation1, false, layer_bounds, layer_rect, frame_number++, | 4709 &client, &invalidation1, false, layer_bounds, layer_rect, frame_number++, |
| 4710 Picture::RECORD_NORMALLY); | 4710 RecordingSource::RECORD_NORMALLY); |
| 4711 | 4711 |
| 4712 scoped_refptr<RasterSource> raster_source1 = | 4712 scoped_refptr<RasterSource> raster_source1 = |
| 4713 recording_source->CreateRasterSource(); | 4713 recording_source->CreateRasterSource(); |
| 4714 | 4714 |
| 4715 SetupPendingTree(raster_source1); | 4715 SetupPendingTree(raster_source1); |
| 4716 ActivateTree(); | 4716 ActivateTree(); |
| 4717 host_impl_.active_tree()->UpdateDrawProperties(); | 4717 host_impl_.active_tree()->UpdateDrawProperties(); |
| 4718 | 4718 |
| 4719 // We've started with a solid layer that contains some tilings. | 4719 // We've started with a solid layer that contains some tilings. |
| 4720 ASSERT_TRUE(active_layer_->tilings()); | 4720 ASSERT_TRUE(active_layer_->tilings()); |
| 4721 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); | 4721 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); |
| 4722 | 4722 |
| 4723 client.set_fill_with_nonsolid_color(false); | 4723 client.set_fill_with_nonsolid_color(false); |
| 4724 | 4724 |
| 4725 Region invalidation2(layer_rect); | 4725 Region invalidation2(layer_rect); |
| 4726 recording_source->UpdateAndExpandInvalidation( | 4726 recording_source->UpdateAndExpandInvalidation( |
| 4727 &client, &invalidation2, false, layer_bounds, layer_rect, frame_number++, | 4727 &client, &invalidation2, false, layer_bounds, layer_rect, frame_number++, |
| 4728 Picture::RECORD_NORMALLY); | 4728 RecordingSource::RECORD_NORMALLY); |
| 4729 | 4729 |
| 4730 scoped_refptr<RasterSource> raster_source2 = | 4730 scoped_refptr<RasterSource> raster_source2 = |
| 4731 recording_source->CreateRasterSource(); | 4731 recording_source->CreateRasterSource(); |
| 4732 | 4732 |
| 4733 SetupPendingTree(raster_source2); | 4733 SetupPendingTree(raster_source2); |
| 4734 ActivateTree(); | 4734 ActivateTree(); |
| 4735 | 4735 |
| 4736 // We've switched to a solid color, so we should end up with no tilings. | 4736 // We've switched to a solid color, so we should end up with no tilings. |
| 4737 ASSERT_TRUE(active_layer_->tilings()); | 4737 ASSERT_TRUE(active_layer_->tilings()); |
| 4738 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4738 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4917 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4917 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4918 EXPECT_EQ(result.width(), 448); | 4918 EXPECT_EQ(result.width(), 448); |
| 4919 EXPECT_EQ(result.height(), 448); | 4919 EXPECT_EQ(result.height(), 448); |
| 4920 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4920 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4921 EXPECT_EQ(result.width(), 512); | 4921 EXPECT_EQ(result.width(), 512); |
| 4922 EXPECT_EQ(result.height(), 500 + 2); | 4922 EXPECT_EQ(result.height(), 500 + 2); |
| 4923 } | 4923 } |
| 4924 | 4924 |
| 4925 } // namespace | 4925 } // namespace |
| 4926 } // namespace cc | 4926 } // namespace cc |
| OLD | NEW |