| 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/proto/layer.pb.h" | 18 #include "cc/proto/layer.pb.h" |
| 18 #include "cc/test/fake_client_picture_cache.h" | 19 #include "cc/test/fake_client_picture_cache.h" |
| 19 #include "cc/test/fake_compositor_frame_sink.h" | 20 #include "cc/test/fake_compositor_frame_sink.h" |
| 20 #include "cc/test/fake_engine_picture_cache.h" | 21 #include "cc/test/fake_engine_picture_cache.h" |
| 21 #include "cc/test/fake_image_serialization_processor.h" | 22 #include "cc/test/fake_image_serialization_processor.h" |
| 22 #include "cc/test/fake_layer_tree_host.h" | 23 #include "cc/test/fake_layer_tree_host.h" |
| 23 #include "cc/test/fake_picture_layer.h" | 24 #include "cc/test/fake_picture_layer.h" |
| 24 #include "cc/test/fake_picture_layer_impl.h" | 25 #include "cc/test/fake_picture_layer_impl.h" |
| 25 #include "cc/test/fake_proxy.h" | 26 #include "cc/test/fake_proxy.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 layer->PushPropertiesTo(layer_impl); | 164 layer->PushPropertiesTo(layer_impl); |
| 164 | 165 |
| 165 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 166 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
| 166 } | 167 } |
| 167 | 168 |
| 168 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 169 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
| 169 gfx::Size layer_size(50, 50); | 170 gfx::Size layer_size(50, 50); |
| 170 FakeContentLayerClient client; | 171 FakeContentLayerClient client; |
| 171 client.set_bounds(layer_size); | 172 client.set_bounds(layer_size); |
| 172 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), | 173 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), |
| 173 SkPaint()); | 174 PaintFlags()); |
| 174 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 175 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 175 layer->SetBounds(gfx::Size(10, 10)); | 176 layer->SetBounds(gfx::Size(10, 10)); |
| 176 | 177 |
| 177 FakeLayerTreeHostClient host_client; | 178 FakeLayerTreeHostClient host_client; |
| 178 TestTaskGraphRunner task_graph_runner; | 179 TestTaskGraphRunner task_graph_runner; |
| 179 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 180 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 180 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 181 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
| 181 &host_client, &task_graph_runner, animation_host.get()); | 182 &host_client, &task_graph_runner, animation_host.get()); |
| 182 host->GetLayerTree()->SetRootLayer(layer); | 183 host->GetLayerTree()->SetRootLayer(layer); |
| 183 layer->SetIsDrawable(true); | 184 layer->SetIsDrawable(true); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 host2->Composite(base::TimeTicks::Now()); | 360 host2->Composite(base::TimeTicks::Now()); |
| 360 EXPECT_EQ(3, layer->update_count()); | 361 EXPECT_EQ(3, layer->update_count()); |
| 361 EXPECT_EQ(1, host2->SourceFrameNumber()); | 362 EXPECT_EQ(1, host2->SourceFrameNumber()); |
| 362 | 363 |
| 363 animation_host->SetMutatorHostClient(nullptr); | 364 animation_host->SetMutatorHostClient(nullptr); |
| 364 animation_host2->SetMutatorHostClient(nullptr); | 365 animation_host2->SetMutatorHostClient(nullptr); |
| 365 } | 366 } |
| 366 | 367 |
| 367 } // namespace | 368 } // namespace |
| 368 } // namespace cc | 369 } // namespace cc |
| OLD | NEW |