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 21 matching lines...) Expand all Loading... |
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; |
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); | 38 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); |
39 pile.SetRecordedViewport(gfx::Rect(layer_bounds)); | 39 pile.SetRecordedViewport(gfx::Rect(layer_bounds)); |
40 pile.SetHasAnyRecordings(true); | 40 pile.SetHasAnyRecordings(true); |
41 | 41 |
42 auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); | 42 scoped_refptr<FakePicturePileImpl> pile_impl( |
| 43 new FakePicturePileImpl(&pile, nullptr)); |
43 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) { | 44 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) { |
44 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y) | 45 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y) |
45 pile_impl->AddRecordingAt(x, y); | 46 pile_impl->AddRecordingAt(x, y); |
46 } | 47 } |
47 return pile_impl; | 48 return pile_impl; |
48 } | 49 } |
49 | 50 |
50 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( | 51 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( |
51 const gfx::Size& tile_size, | 52 const gfx::Size& tile_size, |
52 const gfx::Size& layer_bounds) { | 53 const gfx::Size& layer_bounds) { |
(...skipping 24 matching lines...) Expand all Loading... |
77 FakePicturePileImpl::CreateInfiniteFilledPile() { | 78 FakePicturePileImpl::CreateInfiniteFilledPile() { |
78 FakePicturePile pile; | 79 FakePicturePile pile; |
79 gfx::Size size(std::numeric_limits<int>::max(), | 80 gfx::Size size(std::numeric_limits<int>::max(), |
80 std::numeric_limits<int>::max()); | 81 std::numeric_limits<int>::max()); |
81 pile.tiling().SetTilingSize(size); | 82 pile.tiling().SetTilingSize(size); |
82 pile.tiling().SetMaxTextureSize(size); | 83 pile.tiling().SetMaxTextureSize(size); |
83 pile.SetTileGridSize(size); | 84 pile.SetTileGridSize(size); |
84 pile.SetRecordedViewport(gfx::Rect(size)); | 85 pile.SetRecordedViewport(gfx::Rect(size)); |
85 pile.SetHasAnyRecordings(true); | 86 pile.SetHasAnyRecordings(true); |
86 | 87 |
87 auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); | 88 scoped_refptr<FakePicturePileImpl> pile_impl( |
| 89 new FakePicturePileImpl(&pile, nullptr)); |
88 pile_impl->AddRecordingAt(0, 0); | 90 pile_impl->AddRecordingAt(0, 0); |
89 return pile_impl; | 91 return pile_impl; |
90 } | 92 } |
91 | 93 |
92 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile( | 94 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile( |
93 const PicturePile* other, | 95 const PicturePile* other, |
94 base::WaitableEvent* playback_allowed_event) { | 96 base::WaitableEvent* playback_allowed_event) { |
95 return make_scoped_refptr( | 97 return make_scoped_refptr( |
96 new FakePicturePileImpl(other, playback_allowed_event)); | 98 new FakePicturePileImpl(other, playback_allowed_event)); |
97 } | 99 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 Clear(); | 180 Clear(); |
179 tiling_.SetBorderTexels(new_buffer_pixels); | 181 tiling_.SetBorderTexels(new_buffer_pixels); |
180 } | 182 } |
181 | 183 |
182 void FakePicturePileImpl::Clear() { | 184 void FakePicturePileImpl::Clear() { |
183 picture_map_.clear(); | 185 picture_map_.clear(); |
184 recorded_viewport_ = gfx::Rect(); | 186 recorded_viewport_ = gfx::Rect(); |
185 } | 187 } |
186 | 188 |
187 } // namespace cc | 189 } // namespace cc |
OLD | NEW |