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/test/impl_side_painting_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 gfx::Size tile_size, | 20 const gfx::Size& tile_size, |
21 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().SetTotalSize(layer_bounds); | 23 pile->tiling().SetTotalSize(layer_bounds); |
24 pile->tiling().SetMaxTextureSize(tile_size); | 24 pile->tiling().SetMaxTextureSize(tile_size); |
25 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 25 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); |
26 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { | 26 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { |
27 for (int y = 0; y < pile->tiling().num_tiles_y(); ++y) | 27 for (int y = 0; y < pile->tiling().num_tiles_y(); ++y) |
28 pile->AddRecordingAt(x, y); | 28 pile->AddRecordingAt(x, y); |
29 } | 29 } |
30 pile->UpdateRecordedRegion(); | 30 pile->UpdateRecordedRegion(); |
31 return pile; | 31 return pile; |
32 } | 32 } |
33 | 33 |
34 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( | 34 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( |
35 gfx::Size tile_size, | 35 const gfx::Size& tile_size, |
36 gfx::Size layer_bounds) { | 36 const gfx::Size& layer_bounds) { |
37 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 37 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
38 pile->tiling().SetTotalSize(layer_bounds); | 38 pile->tiling().SetTotalSize(layer_bounds); |
39 pile->tiling().SetMaxTextureSize(tile_size); | 39 pile->tiling().SetMaxTextureSize(tile_size); |
40 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 40 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); |
41 pile->UpdateRecordedRegion(); | 41 pile->UpdateRecordedRegion(); |
42 return pile; | 42 return pile; |
43 } | 43 } |
44 | 44 |
45 scoped_refptr<FakePicturePileImpl> | 45 scoped_refptr<FakePicturePileImpl> |
46 FakePicturePileImpl::CreatePileWithRecordedRegion( | 46 FakePicturePileImpl::CreatePileWithRecordedRegion( |
47 gfx::Size tile_size, | 47 const gfx::Size& tile_size, |
48 gfx::Size layer_bounds, | 48 const gfx::Size& layer_bounds, |
49 const Region& recorded_region) { | 49 const Region& recorded_region) { |
50 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); | 50 scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); |
51 pile->tiling().SetTotalSize(layer_bounds); | 51 pile->tiling().SetTotalSize(layer_bounds); |
52 pile->tiling().SetMaxTextureSize(tile_size); | 52 pile->tiling().SetMaxTextureSize(tile_size); |
53 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 53 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); |
54 pile->SetRecordedRegionForTesting(recorded_region); | 54 pile->SetRecordedRegionForTesting(recorded_region); |
55 return pile; | 55 return pile; |
56 } | 56 } |
57 | 57 |
58 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreatePile() { | 58 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreatePile() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void FakePicturePileImpl::RerecordPile() { | 101 void FakePicturePileImpl::RerecordPile() { |
102 for (int y = 0; y < num_tiles_y(); ++y) { | 102 for (int y = 0; y < num_tiles_y(); ++y) { |
103 for (int x = 0; x < num_tiles_x(); ++x) { | 103 for (int x = 0; x < num_tiles_x(); ++x) { |
104 RemoveRecordingAt(x, y); | 104 RemoveRecordingAt(x, y); |
105 AddRecordingAt(x, y); | 105 AddRecordingAt(x, y); |
106 } | 106 } |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace cc | 110 } // namespace cc |
OLD | NEW |