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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 LayerTreeSettings settings; | 408 LayerTreeSettings settings; |
409 gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2, | 409 gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2, |
410 settings.default_tile_size.height() * 7 / 2); | 410 settings.default_tile_size.height() * 7 / 2); |
411 | 411 |
412 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = | 412 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = |
413 FakeDisplayListRasterSource::CreateFilled(layer_size); | 413 FakeDisplayListRasterSource::CreateFilled(layer_size); |
414 | 414 |
415 // Create an active recording source, but make sure it's not solid. | 415 // Create an active recording source, but make sure it's not solid. |
416 scoped_ptr<FakeDisplayListRecordingSource> active_recording_source = | 416 scoped_ptr<FakeDisplayListRecordingSource> active_recording_source = |
417 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_size); | 417 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_size); |
| 418 active_recording_source->SetLayerBounds(layer_size); |
418 active_recording_source->add_draw_rect(gfx::Rect(layer_size)); | 419 active_recording_source->add_draw_rect(gfx::Rect(layer_size)); |
419 active_recording_source->add_draw_rect( | 420 active_recording_source->add_draw_rect( |
420 gfx::Rect(0, 0, layer_size.width() - 1, layer_size.height() - 1)); | 421 gfx::Rect(0, 0, layer_size.width() - 1, layer_size.height() - 1)); |
421 active_recording_source->Rerecord(); | 422 active_recording_source->Rerecord(); |
422 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = | 423 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = |
423 FakeDisplayListRasterSource::CreateFromRecordingSource( | 424 FakeDisplayListRasterSource::CreateFromRecordingSource( |
424 active_recording_source.get(), false); | 425 active_recording_source.get(), false); |
425 | 426 |
426 SetupTrees(pending_raster_source, active_raster_source); | 427 SetupTrees(pending_raster_source, active_raster_source); |
427 | 428 |
(...skipping 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4488 } | 4489 } |
4489 | 4490 |
4490 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { | 4491 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { |
4491 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4492 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
4492 | 4493 |
4493 gfx::Size tile_size(100, 100); | 4494 gfx::Size tile_size(100, 100); |
4494 gfx::Size layer_bounds(200, 200); | 4495 gfx::Size layer_bounds(200, 200); |
4495 gfx::Rect layer_rect(layer_bounds); | 4496 gfx::Rect layer_rect(layer_bounds); |
4496 | 4497 |
4497 FakeContentLayerClient client; | 4498 FakeContentLayerClient client; |
| 4499 client.set_bounds(layer_bounds); |
4498 scoped_refptr<PictureLayer> layer = | 4500 scoped_refptr<PictureLayer> layer = |
4499 PictureLayer::Create(layer_settings_, &client); | 4501 PictureLayer::Create(layer_settings_, &client); |
4500 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4502 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4501 TestTaskGraphRunner task_graph_runner; | 4503 TestTaskGraphRunner task_graph_runner; |
4502 scoped_ptr<FakeLayerTreeHost> host = | 4504 scoped_ptr<FakeLayerTreeHost> host = |
4503 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 4505 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
4504 host->SetRootLayer(layer); | 4506 host->SetRootLayer(layer); |
4505 DisplayListRecordingSource* recording_source = | 4507 DisplayListRecordingSource* recording_source = |
4506 layer->GetDisplayListRecordingSourceForTesting(); | 4508 layer->GetDisplayListRecordingSourceForTesting(); |
4507 | 4509 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4552 } | 4554 } |
4553 | 4555 |
4554 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { | 4556 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { |
4555 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4557 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
4556 | 4558 |
4557 gfx::Size tile_size(100, 100); | 4559 gfx::Size tile_size(100, 100); |
4558 gfx::Size layer_bounds(200, 200); | 4560 gfx::Size layer_bounds(200, 200); |
4559 gfx::Rect layer_rect(layer_bounds); | 4561 gfx::Rect layer_rect(layer_bounds); |
4560 | 4562 |
4561 FakeContentLayerClient client; | 4563 FakeContentLayerClient client; |
| 4564 client.set_bounds(layer_bounds); |
4562 scoped_refptr<PictureLayer> layer = | 4565 scoped_refptr<PictureLayer> layer = |
4563 PictureLayer::Create(layer_settings_, &client); | 4566 PictureLayer::Create(layer_settings_, &client); |
4564 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4567 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4565 TestTaskGraphRunner task_graph_runner; | 4568 TestTaskGraphRunner task_graph_runner; |
4566 scoped_ptr<FakeLayerTreeHost> host = | 4569 scoped_ptr<FakeLayerTreeHost> host = |
4567 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 4570 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
4568 host->SetRootLayer(layer); | 4571 host->SetRootLayer(layer); |
4569 DisplayListRecordingSource* recording_source = | 4572 DisplayListRecordingSource* recording_source = |
4570 layer->GetDisplayListRecordingSourceForTesting(); | 4573 layer->GetDisplayListRecordingSourceForTesting(); |
4571 | 4574 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5042 // New low res tiling. | 5045 // New low res tiling. |
5043 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 5046 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
5044 | 5047 |
5045 // This tiling will be high res now, it won't contain low res content since it | 5048 // This tiling will be high res now, it won't contain low res content since it |
5046 // was all destroyed. | 5049 // was all destroyed. |
5047 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 5050 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
5048 } | 5051 } |
5049 | 5052 |
5050 } // namespace | 5053 } // namespace |
5051 } // namespace cc | 5054 } // namespace cc |
OLD | NEW |