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 4486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4497 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4497 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
4498 | 4498 |
4499 host_impl_.SetViewportSize(layer_bounds); | 4499 host_impl_.SetViewportSize(layer_bounds); |
4500 | 4500 |
4501 int frame_number = 0; | 4501 int frame_number = 0; |
4502 | 4502 |
4503 client.set_fill_with_nonsolid_color(!test_for_solid); | 4503 client.set_fill_with_nonsolid_color(!test_for_solid); |
4504 | 4504 |
4505 Region invalidation(layer_rect); | 4505 Region invalidation(layer_rect); |
4506 recording_source->UpdateAndExpandInvalidation( | 4506 recording_source->UpdateAndExpandInvalidation( |
4507 &client, &invalidation, layer_bounds, layer_rect, frame_number++, | 4507 &client, &invalidation, false, layer_bounds, layer_rect, frame_number++, |
4508 Picture::RECORD_NORMALLY); | 4508 Picture::RECORD_NORMALLY); |
4509 | 4509 |
4510 scoped_refptr<RasterSource> pending_raster_source = | 4510 scoped_refptr<RasterSource> pending_raster_source = |
4511 recording_source->CreateRasterSource(); | 4511 recording_source->CreateRasterSource(); |
4512 | 4512 |
4513 SetupPendingTree(pending_raster_source); | 4513 SetupPendingTree(pending_raster_source); |
4514 ActivateTree(); | 4514 ActivateTree(); |
4515 | 4515 |
4516 active_layer_->set_fixed_tile_size(tile_size); | 4516 active_layer_->set_fixed_tile_size(tile_size); |
4517 host_impl_.active_tree()->UpdateDrawProperties(); | 4517 host_impl_.active_tree()->UpdateDrawProperties(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4564 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
4565 | 4565 |
4566 host_impl_.SetViewportSize(layer_bounds); | 4566 host_impl_.SetViewportSize(layer_bounds); |
4567 | 4567 |
4568 int frame_number = 0; | 4568 int frame_number = 0; |
4569 | 4569 |
4570 client.set_fill_with_nonsolid_color(true); | 4570 client.set_fill_with_nonsolid_color(true); |
4571 | 4571 |
4572 Region invalidation1(layer_rect); | 4572 Region invalidation1(layer_rect); |
4573 recording_source->UpdateAndExpandInvalidation( | 4573 recording_source->UpdateAndExpandInvalidation( |
4574 &client, &invalidation1, layer_bounds, layer_rect, frame_number++, | 4574 &client, &invalidation1, false, layer_bounds, layer_rect, frame_number++, |
4575 Picture::RECORD_NORMALLY); | 4575 Picture::RECORD_NORMALLY); |
4576 | 4576 |
4577 scoped_refptr<RasterSource> raster_source1 = | 4577 scoped_refptr<RasterSource> raster_source1 = |
4578 recording_source->CreateRasterSource(); | 4578 recording_source->CreateRasterSource(); |
4579 | 4579 |
4580 SetupPendingTree(raster_source1); | 4580 SetupPendingTree(raster_source1); |
4581 ActivateTree(); | 4581 ActivateTree(); |
4582 host_impl_.active_tree()->UpdateDrawProperties(); | 4582 host_impl_.active_tree()->UpdateDrawProperties(); |
4583 | 4583 |
4584 // We've started with a solid layer that contains some tilings. | 4584 // We've started with a solid layer that contains some tilings. |
4585 ASSERT_TRUE(active_layer_->tilings()); | 4585 ASSERT_TRUE(active_layer_->tilings()); |
4586 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); | 4586 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); |
4587 | 4587 |
4588 client.set_fill_with_nonsolid_color(false); | 4588 client.set_fill_with_nonsolid_color(false); |
4589 | 4589 |
4590 Region invalidation2(layer_rect); | 4590 Region invalidation2(layer_rect); |
4591 recording_source->UpdateAndExpandInvalidation( | 4591 recording_source->UpdateAndExpandInvalidation( |
4592 &client, &invalidation2, layer_bounds, layer_rect, frame_number++, | 4592 &client, &invalidation2, false, layer_bounds, layer_rect, frame_number++, |
4593 Picture::RECORD_NORMALLY); | 4593 Picture::RECORD_NORMALLY); |
4594 | 4594 |
4595 scoped_refptr<RasterSource> raster_source2 = | 4595 scoped_refptr<RasterSource> raster_source2 = |
4596 recording_source->CreateRasterSource(); | 4596 recording_source->CreateRasterSource(); |
4597 | 4597 |
4598 SetupPendingTree(raster_source2); | 4598 SetupPendingTree(raster_source2); |
4599 ActivateTree(); | 4599 ActivateTree(); |
4600 | 4600 |
4601 // We've switched to a solid color, so we should end up with no tilings. | 4601 // We've switched to a solid color, so we should end up with no tilings. |
4602 ASSERT_TRUE(active_layer_->tilings()); | 4602 ASSERT_TRUE(active_layer_->tilings()); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4722 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4722 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4723 EXPECT_EQ(result.width(), 448); | 4723 EXPECT_EQ(result.width(), 448); |
4724 EXPECT_EQ(result.height(), 448); | 4724 EXPECT_EQ(result.height(), 448); |
4725 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4725 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4726 EXPECT_EQ(result.width(), 512); | 4726 EXPECT_EQ(result.width(), 512); |
4727 EXPECT_EQ(result.height(), 500 + 2); | 4727 EXPECT_EQ(result.height(), 500 + 2); |
4728 } | 4728 } |
4729 | 4729 |
4730 } // namespace | 4730 } // namespace |
4731 } // namespace cc | 4731 } // namespace cc |
OLD | NEW |