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