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