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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 FakeImplProxy proxy_; | 334 FakeImplProxy proxy_; |
335 TestSharedBitmapManager shared_bitmap_manager_; | 335 TestSharedBitmapManager shared_bitmap_manager_; |
336 TestTaskGraphRunner task_graph_runner_; | 336 TestTaskGraphRunner task_graph_runner_; |
337 FakeLayerTreeHostImpl host_impl_; | 337 FakeLayerTreeHostImpl host_impl_; |
338 int root_id_; | 338 int root_id_; |
339 int id_; | 339 int id_; |
340 FakePictureLayerImpl* pending_layer_; | 340 FakePictureLayerImpl* pending_layer_; |
341 FakePictureLayerImpl* old_pending_layer_; | 341 FakePictureLayerImpl* old_pending_layer_; |
342 FakePictureLayerImpl* active_layer_; | 342 FakePictureLayerImpl* active_layer_; |
| 343 LayerSettings layer_settings_; |
343 | 344 |
344 private: | 345 private: |
345 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); | 346 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); |
346 }; | 347 }; |
347 | 348 |
348 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { | 349 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { |
349 public: | 350 public: |
350 NoLowResPictureLayerImplTest() | 351 NoLowResPictureLayerImplTest() |
351 : PictureLayerImplTest(NoLowResTilingsSettings()) {} | 352 : PictureLayerImplTest(NoLowResTilingsSettings()) {} |
352 }; | 353 }; |
(...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 base::TimeTicks time_ticks; | 4631 base::TimeTicks time_ticks; |
4631 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4632 time_ticks += base::TimeDelta::FromMilliseconds(1); |
4632 host_impl_.SetCurrentBeginFrameArgs( | 4633 host_impl_.SetCurrentBeginFrameArgs( |
4633 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4634 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4634 | 4635 |
4635 gfx::Size tile_size(100, 100); | 4636 gfx::Size tile_size(100, 100); |
4636 gfx::Size layer_bounds(200, 200); | 4637 gfx::Size layer_bounds(200, 200); |
4637 gfx::Rect layer_rect(layer_bounds); | 4638 gfx::Rect layer_rect(layer_bounds); |
4638 | 4639 |
4639 FakeContentLayerClient client; | 4640 FakeContentLayerClient client; |
4640 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4641 scoped_refptr<PictureLayer> layer = |
| 4642 PictureLayer::Create(layer_settings_, &client); |
4641 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4643 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4642 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4644 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
4643 host->SetRootLayer(layer); | 4645 host->SetRootLayer(layer); |
4644 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4646 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
4645 | 4647 |
4646 int frame_number = 0; | 4648 int frame_number = 0; |
4647 | 4649 |
4648 client.set_fill_with_nonsolid_color(!test_for_solid); | 4650 client.set_fill_with_nonsolid_color(!test_for_solid); |
4649 | 4651 |
4650 Region invalidation(layer_rect); | 4652 Region invalidation(layer_rect); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4693 base::TimeTicks time_ticks; | 4695 base::TimeTicks time_ticks; |
4694 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4696 time_ticks += base::TimeDelta::FromMilliseconds(1); |
4695 host_impl_.SetCurrentBeginFrameArgs( | 4697 host_impl_.SetCurrentBeginFrameArgs( |
4696 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4698 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
4697 | 4699 |
4698 gfx::Size tile_size(100, 100); | 4700 gfx::Size tile_size(100, 100); |
4699 gfx::Size layer_bounds(200, 200); | 4701 gfx::Size layer_bounds(200, 200); |
4700 gfx::Rect layer_rect(layer_bounds); | 4702 gfx::Rect layer_rect(layer_bounds); |
4701 | 4703 |
4702 FakeContentLayerClient client; | 4704 FakeContentLayerClient client; |
4703 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4705 scoped_refptr<PictureLayer> layer = |
| 4706 PictureLayer::Create(layer_settings_, &client); |
4704 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4707 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4705 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4708 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
4706 host->SetRootLayer(layer); | 4709 host->SetRootLayer(layer); |
4707 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4710 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); |
4708 | 4711 |
4709 int frame_number = 0; | 4712 int frame_number = 0; |
4710 | 4713 |
4711 client.set_fill_with_nonsolid_color(true); | 4714 client.set_fill_with_nonsolid_color(true); |
4712 | 4715 |
4713 Region invalidation1(layer_rect); | 4716 Region invalidation1(layer_rect); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5074 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 5077 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
5075 EXPECT_EQ(result.width(), 448); | 5078 EXPECT_EQ(result.width(), 448); |
5076 EXPECT_EQ(result.height(), 448); | 5079 EXPECT_EQ(result.height(), 448); |
5077 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 5080 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
5078 EXPECT_EQ(result.width(), 512); | 5081 EXPECT_EQ(result.width(), 512); |
5079 EXPECT_EQ(result.height(), 500 + 2); | 5082 EXPECT_EQ(result.height(), 500 + 2); |
5080 } | 5083 } |
5081 | 5084 |
5082 } // namespace | 5085 } // namespace |
5083 } // namespace cc | 5086 } // namespace cc |
OLD | NEW |