| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 active_layer_(nullptr) {} | 64 active_layer_(nullptr) {} |
| 65 | 65 |
| 66 explicit PictureLayerImplTest(const LayerTreeSettings& settings) | 66 explicit PictureLayerImplTest(const LayerTreeSettings& settings) |
| 67 : proxy_(base::MessageLoopProxy::current()), | 67 : proxy_(base::MessageLoopProxy::current()), |
| 68 host_impl_(settings, &proxy_, &shared_bitmap_manager_), | 68 host_impl_(settings, &proxy_, &shared_bitmap_manager_), |
| 69 id_(7) {} | 69 id_(7) {} |
| 70 | 70 |
| 71 virtual ~PictureLayerImplTest() { | 71 virtual ~PictureLayerImplTest() { |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void SetUp() override { | 74 void SetUp() override { InitializeRenderer(); } |
| 75 InitializeRenderer(); | |
| 76 } | |
| 77 | 75 |
| 78 virtual void InitializeRenderer() { | 76 virtual void InitializeRenderer() { |
| 79 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); | 77 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); |
| 80 } | 78 } |
| 81 | 79 |
| 82 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 80 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
| 83 gfx::Size tile_size(100, 100); | 81 gfx::Size tile_size(100, 100); |
| 84 | 82 |
| 85 scoped_refptr<FakePicturePileImpl> pending_pile = | 83 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 86 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 84 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 | 2465 |
| 2468 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest { | 2466 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest { |
| 2469 public: | 2467 public: |
| 2470 void InitializeRenderer() override { | 2468 void InitializeRenderer() override { |
| 2471 bool delegated_rendering = false; | 2469 bool delegated_rendering = false; |
| 2472 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL( | 2470 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL( |
| 2473 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), | 2471 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), |
| 2474 delegated_rendering)); | 2472 delegated_rendering)); |
| 2475 } | 2473 } |
| 2476 | 2474 |
| 2477 virtual void SetUp() override { | 2475 void SetUp() override { |
| 2478 PictureLayerImplTest::SetUp(); | 2476 PictureLayerImplTest::SetUp(); |
| 2479 | 2477 |
| 2480 // Create some default active and pending trees. | 2478 // Create some default active and pending trees. |
| 2481 gfx::Size tile_size(100, 100); | 2479 gfx::Size tile_size(100, 100); |
| 2482 gfx::Size layer_bounds(400, 400); | 2480 gfx::Size layer_bounds(400, 400); |
| 2483 | 2481 |
| 2484 scoped_refptr<FakePicturePileImpl> pending_pile = | 2482 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 2485 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2483 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2486 scoped_refptr<FakePicturePileImpl> active_pile = | 2484 scoped_refptr<FakePicturePileImpl> active_pile = |
| 2487 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2485 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| (...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4722 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4720 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4723 EXPECT_EQ(result.width(), 448); | 4721 EXPECT_EQ(result.width(), 448); |
| 4724 EXPECT_EQ(result.height(), 448); | 4722 EXPECT_EQ(result.height(), 448); |
| 4725 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4723 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4726 EXPECT_EQ(result.width(), 512); | 4724 EXPECT_EQ(result.width(), 512); |
| 4727 EXPECT_EQ(result.height(), 500 + 2); | 4725 EXPECT_EQ(result.height(), 500 + 2); |
| 4728 } | 4726 } |
| 4729 | 4727 |
| 4730 } // namespace | 4728 } // namespace |
| 4731 } // namespace cc | 4729 } // namespace cc |
| OLD | NEW |