| 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/test/fake_picture_pile_impl.h" | 5 #include "cc/test/fake_picture_pile_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "cc/test/impl_side_painting_settings.h" | 10 #include "cc/trees/layer_tree_settings.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 FakePicturePileImpl::FakePicturePileImpl() {} | 15 FakePicturePileImpl::FakePicturePileImpl() {} |
| 16 | 16 |
| 17 FakePicturePileImpl::~FakePicturePileImpl() {} | 17 FakePicturePileImpl::~FakePicturePileImpl() {} |
| 18 | 18 |
| 19 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( | 19 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( |
| 20 const gfx::Size& tile_size, | 20 const gfx::Size& tile_size, |
| 21 const gfx::Size& layer_bounds) { | 21 const gfx::Size& layer_bounds) { |
| 22 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 22 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
| 23 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); | 23 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); |
| 24 pile->tiling().SetMaxTextureSize(tile_size); | 24 pile->tiling().SetMaxTextureSize(tile_size); |
| 25 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 25 pile->SetTileGridSize(LayerTreeSettings().default_tile_size); |
| 26 pile->recorded_viewport_ = gfx::Rect(layer_bounds); | 26 pile->recorded_viewport_ = gfx::Rect(layer_bounds); |
| 27 pile->has_any_recordings_ = true; | 27 pile->has_any_recordings_ = true; |
| 28 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { | 28 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { |
| 29 for (int y = 0; y < pile->tiling().num_tiles_y(); ++y) | 29 for (int y = 0; y < pile->tiling().num_tiles_y(); ++y) |
| 30 pile->AddRecordingAt(x, y); | 30 pile->AddRecordingAt(x, y); |
| 31 } | 31 } |
| 32 return pile; | 32 return pile; |
| 33 } | 33 } |
| 34 | 34 |
| 35 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( | 35 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( |
| 36 const gfx::Size& tile_size, | 36 const gfx::Size& tile_size, |
| 37 const gfx::Size& layer_bounds) { | 37 const gfx::Size& layer_bounds) { |
| 38 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 38 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
| 39 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); | 39 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); |
| 40 pile->tiling().SetMaxTextureSize(tile_size); | 40 pile->tiling().SetMaxTextureSize(tile_size); |
| 41 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 41 pile->SetTileGridSize(LayerTreeSettings().default_tile_size); |
| 42 pile->recorded_viewport_ = gfx::Rect(); | 42 pile->recorded_viewport_ = gfx::Rect(); |
| 43 pile->has_any_recordings_ = false; | 43 pile->has_any_recordings_ = false; |
| 44 return pile; | 44 return pile; |
| 45 } | 45 } |
| 46 | 46 |
| 47 scoped_refptr<FakePicturePileImpl> | 47 scoped_refptr<FakePicturePileImpl> |
| 48 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( | 48 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( |
| 49 const gfx::Size& tile_size, | 49 const gfx::Size& tile_size, |
| 50 const gfx::Size& layer_bounds) { | 50 const gfx::Size& layer_bounds) { |
| 51 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 51 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
| 52 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); | 52 pile->tiling().SetTilingRect(gfx::Rect(layer_bounds)); |
| 53 pile->tiling().SetMaxTextureSize(tile_size); | 53 pile->tiling().SetMaxTextureSize(tile_size); |
| 54 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 54 pile->SetTileGridSize(LayerTreeSettings().default_tile_size); |
| 55 // This simulates a false positive for this flag. | 55 // This simulates a false positive for this flag. |
| 56 pile->recorded_viewport_ = gfx::Rect(); | 56 pile->recorded_viewport_ = gfx::Rect(); |
| 57 pile->has_any_recordings_ = true; | 57 pile->has_any_recordings_ = true; |
| 58 return pile; | 58 return pile; |
| 59 } | 59 } |
| 60 | 60 |
| 61 scoped_refptr<FakePicturePileImpl> | 61 scoped_refptr<FakePicturePileImpl> |
| 62 FakePicturePileImpl::CreateInfiniteFilledPile() { | 62 FakePicturePileImpl::CreateInfiniteFilledPile() { |
| 63 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 63 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
| 64 gfx::Size size(std::numeric_limits<int>::max(), | 64 gfx::Size size(std::numeric_limits<int>::max(), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void FakePicturePileImpl::RerecordPile() { | 107 void FakePicturePileImpl::RerecordPile() { |
| 108 for (int y = 0; y < num_tiles_y(); ++y) { | 108 for (int y = 0; y < num_tiles_y(); ++y) { |
| 109 for (int x = 0; x < num_tiles_x(); ++x) { | 109 for (int x = 0; x < num_tiles_x(); ++x) { |
| 110 RemoveRecordingAt(x, y); | 110 RemoveRecordingAt(x, y); |
| 111 AddRecordingAt(x, y); | 111 AddRecordingAt(x, y); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |