| 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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 host_impl.pending_tree()->root_layer()); | 294 host_impl.pending_tree()->root_layer()); |
| 295 layer->PushPropertiesTo(layer_impl); | 295 layer->PushPropertiesTo(layer_impl); |
| 296 | 296 |
| 297 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 297 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
| 298 } | 298 } |
| 299 | 299 |
| 300 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 300 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
| 301 gfx::Size layer_size(50, 50); | 301 gfx::Size layer_size(50, 50); |
| 302 FakeContentLayerClient client; | 302 FakeContentLayerClient client; |
| 303 client.set_bounds(layer_size); | 303 client.set_bounds(layer_size); |
| 304 skia::RefPtr<SkImage> image = CreateDiscardableImage(layer_size); | 304 sk_sp<SkImage> image(CreateDiscardableImage(layer_size)); |
| 305 client.add_draw_image(image.get(), gfx::Point(), SkPaint()); | 305 client.add_draw_image(image.get(), gfx::Point(), SkPaint()); |
| 306 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 306 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 307 layer->SetBounds(gfx::Size(10, 10)); | 307 layer->SetBounds(gfx::Size(10, 10)); |
| 308 | 308 |
| 309 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 309 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 310 TestTaskGraphRunner task_graph_runner; | 310 TestTaskGraphRunner task_graph_runner; |
| 311 std::unique_ptr<FakeLayerTreeHost> host = | 311 std::unique_ptr<FakeLayerTreeHost> host = |
| 312 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 312 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
| 313 host->SetRootLayer(layer); | 313 host->SetRootLayer(layer); |
| 314 layer->SetIsDrawable(true); | 314 layer->SetIsDrawable(true); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 // Do a main frame, record the picture layers. The frame number has changed | 464 // Do a main frame, record the picture layers. The frame number has changed |
| 465 // non-monotonically. | 465 // non-monotonically. |
| 466 layer->SetNeedsDisplay(); | 466 layer->SetNeedsDisplay(); |
| 467 host2->Composite(base::TimeTicks::Now()); | 467 host2->Composite(base::TimeTicks::Now()); |
| 468 EXPECT_EQ(3, layer->update_count()); | 468 EXPECT_EQ(3, layer->update_count()); |
| 469 EXPECT_EQ(1, host2->source_frame_number()); | 469 EXPECT_EQ(1, host2->source_frame_number()); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace | 472 } // namespace |
| 473 } // namespace cc | 473 } // namespace cc |
| OLD | NEW |