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.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "cc/animation/animation_host.h" | 11 #include "cc/animation/animation_host.h" |
12 #include "cc/layers/append_quads_data.h" | 12 #include "cc/layers/append_quads_data.h" |
13 #include "cc/layers/content_layer_client.h" | 13 #include "cc/layers/content_layer_client.h" |
14 #include "cc/layers/empty_content_layer_client.h" | 14 #include "cc/layers/empty_content_layer_client.h" |
15 #include "cc/layers/picture_layer_impl.h" | 15 #include "cc/layers/picture_layer_impl.h" |
| 16 #include "cc/paint/paint_flags.h" |
16 #include "cc/test/fake_compositor_frame_sink.h" | 17 #include "cc/test/fake_compositor_frame_sink.h" |
17 #include "cc/test/fake_layer_tree_host.h" | 18 #include "cc/test/fake_layer_tree_host.h" |
18 #include "cc/test/fake_picture_layer.h" | 19 #include "cc/test/fake_picture_layer.h" |
19 #include "cc/test/fake_picture_layer_impl.h" | 20 #include "cc/test/fake_picture_layer_impl.h" |
20 #include "cc/test/fake_proxy.h" | 21 #include "cc/test/fake_proxy.h" |
21 #include "cc/test/fake_recording_source.h" | 22 #include "cc/test/fake_recording_source.h" |
22 #include "cc/test/layer_tree_settings_for_testing.h" | 23 #include "cc/test/layer_tree_settings_for_testing.h" |
23 #include "cc/test/skia_common.h" | 24 #include "cc/test/skia_common.h" |
24 #include "cc/test/stub_layer_tree_host_single_thread_client.h" | 25 #include "cc/test/stub_layer_tree_host_single_thread_client.h" |
25 #include "cc/test/test_task_graph_runner.h" | 26 #include "cc/test/test_task_graph_runner.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 layer->PushPropertiesTo(layer_impl); | 159 layer->PushPropertiesTo(layer_impl); |
159 | 160 |
160 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 161 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
161 } | 162 } |
162 | 163 |
163 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 164 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
164 gfx::Size layer_size(50, 50); | 165 gfx::Size layer_size(50, 50); |
165 FakeContentLayerClient client; | 166 FakeContentLayerClient client; |
166 client.set_bounds(layer_size); | 167 client.set_bounds(layer_size); |
167 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), | 168 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), |
168 SkPaint()); | 169 PaintFlags()); |
169 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 170 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
170 layer->SetBounds(gfx::Size(10, 10)); | 171 layer->SetBounds(gfx::Size(10, 10)); |
171 | 172 |
172 FakeLayerTreeHostClient host_client; | 173 FakeLayerTreeHostClient host_client; |
173 TestTaskGraphRunner task_graph_runner; | 174 TestTaskGraphRunner task_graph_runner; |
174 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 175 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
175 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 176 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
176 &host_client, &task_graph_runner, animation_host.get()); | 177 &host_client, &task_graph_runner, animation_host.get()); |
177 host->SetRootLayer(layer); | 178 host->SetRootLayer(layer); |
178 layer->SetIsDrawable(true); | 179 layer->SetIsDrawable(true); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 host2->Composite(base::TimeTicks::Now()); | 353 host2->Composite(base::TimeTicks::Now()); |
353 EXPECT_EQ(3, layer->update_count()); | 354 EXPECT_EQ(3, layer->update_count()); |
354 EXPECT_EQ(1, host2->SourceFrameNumber()); | 355 EXPECT_EQ(1, host2->SourceFrameNumber()); |
355 | 356 |
356 animation_host->SetMutatorHostClient(nullptr); | 357 animation_host->SetMutatorHostClient(nullptr); |
357 animation_host2->SetMutatorHostClient(nullptr); | 358 animation_host2->SetMutatorHostClient(nullptr); |
358 } | 359 } |
359 | 360 |
360 } // namespace | 361 } // namespace |
361 } // namespace cc | 362 } // namespace cc |
OLD | NEW |