| 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 4639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4650 host->SetRootLayer(layer); | 4650 host->SetRootLayer(layer); |
| 4651 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4651 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
| 4652 | 4652 |
| 4653 int frame_number = 0; | 4653 int frame_number = 0; |
| 4654 | 4654 |
| 4655 client.set_fill_with_nonsolid_color(!test_for_solid); | 4655 client.set_fill_with_nonsolid_color(!test_for_solid); |
| 4656 | 4656 |
| 4657 Region invalidation(layer_rect); | 4657 Region invalidation(layer_rect); |
| 4658 recording_source->UpdateAndExpandInvalidation( | 4658 recording_source->UpdateAndExpandInvalidation( |
| 4659 &client, &invalidation, layer_bounds, layer_rect, frame_number++, | 4659 &client, &invalidation, layer_bounds, layer_rect, frame_number++, |
| 4660 RecordingSource::RECORD_NORMALLY); | 4660 RecordingSource::RECORD_NORMALLY, nullptr); |
| 4661 | 4661 |
| 4662 scoped_refptr<RasterSource> pending_raster_source = | 4662 scoped_refptr<RasterSource> pending_raster_source = |
| 4663 recording_source->CreateRasterSource(true); | 4663 recording_source->CreateRasterSource(true); |
| 4664 | 4664 |
| 4665 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); | 4665 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); |
| 4666 ActivateTree(); | 4666 ActivateTree(); |
| 4667 | 4667 |
| 4668 if (test_for_solid) { | 4668 if (test_for_solid) { |
| 4669 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4669 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4670 } else { | 4670 } else { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4713 host->SetRootLayer(layer); | 4713 host->SetRootLayer(layer); |
| 4714 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4714 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
| 4715 | 4715 |
| 4716 int frame_number = 0; | 4716 int frame_number = 0; |
| 4717 | 4717 |
| 4718 client.set_fill_with_nonsolid_color(true); | 4718 client.set_fill_with_nonsolid_color(true); |
| 4719 | 4719 |
| 4720 Region invalidation1(layer_rect); | 4720 Region invalidation1(layer_rect); |
| 4721 recording_source->UpdateAndExpandInvalidation( | 4721 recording_source->UpdateAndExpandInvalidation( |
| 4722 &client, &invalidation1, layer_bounds, layer_rect, frame_number++, | 4722 &client, &invalidation1, layer_bounds, layer_rect, frame_number++, |
| 4723 RecordingSource::RECORD_NORMALLY); | 4723 RecordingSource::RECORD_NORMALLY, nullptr); |
| 4724 | 4724 |
| 4725 scoped_refptr<RasterSource> raster_source1 = | 4725 scoped_refptr<RasterSource> raster_source1 = |
| 4726 recording_source->CreateRasterSource(true); | 4726 recording_source->CreateRasterSource(true); |
| 4727 | 4727 |
| 4728 SetupPendingTree(raster_source1); | 4728 SetupPendingTree(raster_source1); |
| 4729 ActivateTree(); | 4729 ActivateTree(); |
| 4730 bool update_lcd_text = false; | 4730 bool update_lcd_text = false; |
| 4731 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 4731 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); |
| 4732 | 4732 |
| 4733 // We've started with a solid layer that contains some tilings. | 4733 // We've started with a solid layer that contains some tilings. |
| 4734 ASSERT_TRUE(active_layer_->tilings()); | 4734 ASSERT_TRUE(active_layer_->tilings()); |
| 4735 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); | 4735 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); |
| 4736 | 4736 |
| 4737 client.set_fill_with_nonsolid_color(false); | 4737 client.set_fill_with_nonsolid_color(false); |
| 4738 | 4738 |
| 4739 Region invalidation2(layer_rect); | 4739 Region invalidation2(layer_rect); |
| 4740 recording_source->UpdateAndExpandInvalidation( | 4740 recording_source->UpdateAndExpandInvalidation( |
| 4741 &client, &invalidation2, layer_bounds, layer_rect, frame_number++, | 4741 &client, &invalidation2, layer_bounds, layer_rect, frame_number++, |
| 4742 RecordingSource::RECORD_NORMALLY); | 4742 RecordingSource::RECORD_NORMALLY, nullptr); |
| 4743 | 4743 |
| 4744 scoped_refptr<RasterSource> raster_source2 = | 4744 scoped_refptr<RasterSource> raster_source2 = |
| 4745 recording_source->CreateRasterSource(true); | 4745 recording_source->CreateRasterSource(true); |
| 4746 | 4746 |
| 4747 SetupPendingTree(raster_source2); | 4747 SetupPendingTree(raster_source2); |
| 4748 ActivateTree(); | 4748 ActivateTree(); |
| 4749 | 4749 |
| 4750 // We've switched to a solid color, so we should end up with no tilings. | 4750 // We've switched to a solid color, so we should end up with no tilings. |
| 4751 ASSERT_TRUE(active_layer_->tilings()); | 4751 ASSERT_TRUE(active_layer_->tilings()); |
| 4752 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4752 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4937 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4937 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4938 EXPECT_EQ(result.width(), 448); | 4938 EXPECT_EQ(result.width(), 448); |
| 4939 EXPECT_EQ(result.height(), 448); | 4939 EXPECT_EQ(result.height(), 448); |
| 4940 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4940 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4941 EXPECT_EQ(result.width(), 512); | 4941 EXPECT_EQ(result.width(), 512); |
| 4942 EXPECT_EQ(result.height(), 500 + 2); | 4942 EXPECT_EQ(result.height(), 500 + 2); |
| 4943 } | 4943 } |
| 4944 | 4944 |
| 4945 } // namespace | 4945 } // namespace |
| 4946 } // namespace cc | 4946 } // namespace cc |
| OLD | NEW |