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