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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
11 #include <set> | 11 #include <set> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
17 #include "cc/base/math_util.h" | 17 #include "cc/base/math_util.h" |
18 #include "cc/layers/append_quads_data.h" | 18 #include "cc/layers/append_quads_data.h" |
19 #include "cc/layers/layer_settings.h" | |
20 #include "cc/layers/picture_layer.h" | 19 #include "cc/layers/picture_layer.h" |
21 #include "cc/quads/draw_quad.h" | 20 #include "cc/quads/draw_quad.h" |
22 #include "cc/quads/tile_draw_quad.h" | 21 #include "cc/quads/tile_draw_quad.h" |
23 #include "cc/test/begin_frame_args_test.h" | 22 #include "cc/test/begin_frame_args_test.h" |
24 #include "cc/test/fake_content_layer_client.h" | 23 #include "cc/test/fake_content_layer_client.h" |
25 #include "cc/test/fake_display_list_raster_source.h" | 24 #include "cc/test/fake_display_list_raster_source.h" |
26 #include "cc/test/fake_display_list_recording_source.h" | 25 #include "cc/test/fake_display_list_recording_source.h" |
27 #include "cc/test/fake_impl_task_runner_provider.h" | 26 #include "cc/test/fake_impl_task_runner_provider.h" |
28 #include "cc/test/fake_layer_tree_host_impl.h" | 27 #include "cc/test/fake_layer_tree_host_impl.h" |
29 #include "cc/test/fake_output_surface.h" | 28 #include "cc/test/fake_output_surface.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 FakeImplTaskRunnerProvider task_runner_provider_; | 392 FakeImplTaskRunnerProvider task_runner_provider_; |
394 TestSharedBitmapManager shared_bitmap_manager_; | 393 TestSharedBitmapManager shared_bitmap_manager_; |
395 TestTaskGraphRunner task_graph_runner_; | 394 TestTaskGraphRunner task_graph_runner_; |
396 scoped_ptr<OutputSurface> output_surface_; | 395 scoped_ptr<OutputSurface> output_surface_; |
397 FakeLayerTreeHostImpl host_impl_; | 396 FakeLayerTreeHostImpl host_impl_; |
398 int root_id_; | 397 int root_id_; |
399 int id_; | 398 int id_; |
400 FakePictureLayerImpl* pending_layer_; | 399 FakePictureLayerImpl* pending_layer_; |
401 FakePictureLayerImpl* old_pending_layer_; | 400 FakePictureLayerImpl* old_pending_layer_; |
402 FakePictureLayerImpl* active_layer_; | 401 FakePictureLayerImpl* active_layer_; |
403 LayerSettings layer_settings_; | |
404 | 402 |
405 private: | 403 private: |
406 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); | 404 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); |
407 }; | 405 }; |
408 | 406 |
409 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { | 407 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { |
410 public: | 408 public: |
411 NoLowResPictureLayerImplTest() | 409 NoLowResPictureLayerImplTest() |
412 : PictureLayerImplTest(NoLowResTilingsSettings()) {} | 410 : PictureLayerImplTest(NoLowResTilingsSettings()) {} |
413 }; | 411 }; |
(...skipping 3962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4376 | 4374 |
4377 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { | 4375 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { |
4378 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4376 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
4379 | 4377 |
4380 gfx::Size tile_size(100, 100); | 4378 gfx::Size tile_size(100, 100); |
4381 gfx::Size layer_bounds(200, 200); | 4379 gfx::Size layer_bounds(200, 200); |
4382 gfx::Rect layer_rect(layer_bounds); | 4380 gfx::Rect layer_rect(layer_bounds); |
4383 | 4381 |
4384 FakeContentLayerClient client; | 4382 FakeContentLayerClient client; |
4385 client.set_bounds(layer_bounds); | 4383 client.set_bounds(layer_bounds); |
4386 scoped_refptr<PictureLayer> layer = | 4384 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
4387 PictureLayer::Create(layer_settings_, &client); | |
4388 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4385 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4389 TestTaskGraphRunner task_graph_runner; | 4386 TestTaskGraphRunner task_graph_runner; |
4390 scoped_ptr<FakeLayerTreeHost> host = | 4387 scoped_ptr<FakeLayerTreeHost> host = |
4391 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 4388 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
4392 host->SetRootLayer(layer); | 4389 host->SetRootLayer(layer); |
4393 DisplayListRecordingSource* recording_source = | 4390 DisplayListRecordingSource* recording_source = |
4394 layer->GetDisplayListRecordingSourceForTesting(); | 4391 layer->GetDisplayListRecordingSourceForTesting(); |
4395 | 4392 |
4396 int frame_number = 0; | 4393 int frame_number = 0; |
4397 | 4394 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4441 | 4438 |
4442 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { | 4439 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { |
4443 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4440 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
4444 | 4441 |
4445 gfx::Size tile_size(100, 100); | 4442 gfx::Size tile_size(100, 100); |
4446 gfx::Size layer_bounds(200, 200); | 4443 gfx::Size layer_bounds(200, 200); |
4447 gfx::Rect layer_rect(layer_bounds); | 4444 gfx::Rect layer_rect(layer_bounds); |
4448 | 4445 |
4449 FakeContentLayerClient client; | 4446 FakeContentLayerClient client; |
4450 client.set_bounds(layer_bounds); | 4447 client.set_bounds(layer_bounds); |
4451 scoped_refptr<PictureLayer> layer = | 4448 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
4452 PictureLayer::Create(layer_settings_, &client); | |
4453 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4449 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
4454 TestTaskGraphRunner task_graph_runner; | 4450 TestTaskGraphRunner task_graph_runner; |
4455 scoped_ptr<FakeLayerTreeHost> host = | 4451 scoped_ptr<FakeLayerTreeHost> host = |
4456 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 4452 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
4457 host->SetRootLayer(layer); | 4453 host->SetRootLayer(layer); |
4458 DisplayListRecordingSource* recording_source = | 4454 DisplayListRecordingSource* recording_source = |
4459 layer->GetDisplayListRecordingSourceForTesting(); | 4455 layer->GetDisplayListRecordingSourceForTesting(); |
4460 | 4456 |
4461 int frame_number = 0; | 4457 int frame_number = 0; |
4462 | 4458 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4923 // New low res tiling. | 4919 // New low res tiling. |
4924 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 4920 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
4925 | 4921 |
4926 // This tiling will be high res now, it won't contain low res content since it | 4922 // This tiling will be high res now, it won't contain low res content since it |
4927 // was all destroyed. | 4923 // was all destroyed. |
4928 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 4924 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
4929 } | 4925 } |
4930 | 4926 |
4931 } // namespace | 4927 } // namespace |
4932 } // namespace cc | 4928 } // namespace cc |
OLD | NEW |