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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 : PicturePileImpl(other), | 25 : PicturePileImpl(other), |
26 playback_allowed_event_(playback_allowed_event), | 26 playback_allowed_event_(playback_allowed_event), |
27 tile_grid_info_(other->GetTileGridInfoForTesting()) { | 27 tile_grid_info_(other->GetTileGridInfoForTesting()) { |
28 } | 28 } |
29 | 29 |
30 FakePicturePileImpl::~FakePicturePileImpl() {} | 30 FakePicturePileImpl::~FakePicturePileImpl() {} |
31 | 31 |
32 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( | 32 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( |
33 const gfx::Size& tile_size, | 33 const gfx::Size& tile_size, |
34 const gfx::Size& layer_bounds) { | 34 const gfx::Size& layer_bounds) { |
35 FakePicturePile pile; | 35 FakePicturePile pile(0.0, ImplSidePaintingSettings().default_tile_grid_size); |
36 pile.tiling().SetTilingSize(layer_bounds); | 36 pile.tiling().SetTilingSize(layer_bounds); |
37 pile.tiling().SetMaxTextureSize(tile_size); | 37 pile.tiling().SetMaxTextureSize(tile_size); |
38 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); | |
39 pile.SetRecordedViewport(gfx::Rect(layer_bounds)); | 38 pile.SetRecordedViewport(gfx::Rect(layer_bounds)); |
40 pile.SetHasAnyRecordings(true); | 39 pile.SetHasAnyRecordings(true); |
41 | 40 |
42 scoped_refptr<FakePicturePileImpl> pile_impl( | 41 scoped_refptr<FakePicturePileImpl> pile_impl( |
43 new FakePicturePileImpl(&pile, nullptr)); | 42 new FakePicturePileImpl(&pile, nullptr)); |
44 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) { | 43 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) { |
45 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y) | 44 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y) |
46 pile_impl->AddRecordingAt(x, y); | 45 pile_impl->AddRecordingAt(x, y); |
47 } | 46 } |
48 return pile_impl; | 47 return pile_impl; |
49 } | 48 } |
50 | 49 |
51 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( | 50 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( |
52 const gfx::Size& tile_size, | 51 const gfx::Size& tile_size, |
53 const gfx::Size& layer_bounds) { | 52 const gfx::Size& layer_bounds) { |
54 FakePicturePile pile; | 53 FakePicturePile pile(0.0, ImplSidePaintingSettings().default_tile_grid_size); |
55 pile.tiling().SetTilingSize(layer_bounds); | 54 pile.tiling().SetTilingSize(layer_bounds); |
56 pile.tiling().SetMaxTextureSize(tile_size); | 55 pile.tiling().SetMaxTextureSize(tile_size); |
57 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); | |
58 pile.SetRecordedViewport(gfx::Rect()); | 56 pile.SetRecordedViewport(gfx::Rect()); |
59 pile.SetHasAnyRecordings(false); | 57 pile.SetHasAnyRecordings(false); |
60 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); | 58 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); |
61 } | 59 } |
62 | 60 |
63 scoped_refptr<FakePicturePileImpl> | 61 scoped_refptr<FakePicturePileImpl> |
64 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( | 62 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( |
65 const gfx::Size& tile_size, | 63 const gfx::Size& tile_size, |
66 const gfx::Size& layer_bounds) { | 64 const gfx::Size& layer_bounds) { |
67 FakePicturePile pile; | 65 FakePicturePile pile(0.0, ImplSidePaintingSettings().default_tile_grid_size); |
68 pile.tiling().SetTilingSize(layer_bounds); | 66 pile.tiling().SetTilingSize(layer_bounds); |
69 pile.tiling().SetMaxTextureSize(tile_size); | 67 pile.tiling().SetMaxTextureSize(tile_size); |
70 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); | |
71 // This simulates a false positive for this flag. | 68 // This simulates a false positive for this flag. |
72 pile.SetRecordedViewport(gfx::Rect()); | 69 pile.SetRecordedViewport(gfx::Rect()); |
73 pile.SetHasAnyRecordings(true); | 70 pile.SetHasAnyRecordings(true); |
74 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); | 71 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); |
75 } | 72 } |
76 | 73 |
77 scoped_refptr<FakePicturePileImpl> | 74 scoped_refptr<FakePicturePileImpl> |
78 FakePicturePileImpl::CreateInfiniteFilledPile() { | 75 FakePicturePileImpl::CreateInfiniteFilledPile() { |
79 FakePicturePile pile; | |
80 gfx::Size size(std::numeric_limits<int>::max(), | 76 gfx::Size size(std::numeric_limits<int>::max(), |
81 std::numeric_limits<int>::max()); | 77 std::numeric_limits<int>::max()); |
| 78 FakePicturePile pile(0.0, size); |
82 pile.tiling().SetTilingSize(size); | 79 pile.tiling().SetTilingSize(size); |
83 pile.tiling().SetMaxTextureSize(size); | 80 pile.tiling().SetMaxTextureSize(size); |
84 pile.SetTileGridSize(size); | |
85 pile.SetRecordedViewport(gfx::Rect(size)); | 81 pile.SetRecordedViewport(gfx::Rect(size)); |
86 pile.SetHasAnyRecordings(true); | 82 pile.SetHasAnyRecordings(true); |
87 | 83 |
88 scoped_refptr<FakePicturePileImpl> pile_impl( | 84 scoped_refptr<FakePicturePileImpl> pile_impl( |
89 new FakePicturePileImpl(&pile, nullptr)); | 85 new FakePicturePileImpl(&pile, nullptr)); |
90 pile_impl->AddRecordingAt(0, 0); | 86 pile_impl->AddRecordingAt(0, 0); |
91 return pile_impl; | 87 return pile_impl; |
92 } | 88 } |
93 | 89 |
94 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile( | 90 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Clear(); | 176 Clear(); |
181 tiling_.SetBorderTexels(new_buffer_pixels); | 177 tiling_.SetBorderTexels(new_buffer_pixels); |
182 } | 178 } |
183 | 179 |
184 void FakePicturePileImpl::Clear() { | 180 void FakePicturePileImpl::Clear() { |
185 picture_map_.clear(); | 181 picture_map_.clear(); |
186 recorded_viewport_ = gfx::Rect(); | 182 recorded_viewport_ = gfx::Rect(); |
187 } | 183 } |
188 | 184 |
189 } // namespace cc | 185 } // namespace cc |
OLD | NEW |