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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 EXPECT_GE(y, 0); | 77 EXPECT_GE(y, 0); |
78 EXPECT_LT(x, tiling_.num_tiles_x()); | 78 EXPECT_LT(x, tiling_.num_tiles_x()); |
79 EXPECT_LT(y, tiling_.num_tiles_y()); | 79 EXPECT_LT(y, tiling_.num_tiles_y()); |
80 | 80 |
81 if (HasRecordingAt(x, y)) | 81 if (HasRecordingAt(x, y)) |
82 return; | 82 return; |
83 gfx::Rect bounds(tiling().TileBounds(x, y)); | 83 gfx::Rect bounds(tiling().TileBounds(x, y)); |
84 bounds.Inset(-buffer_pixels(), -buffer_pixels()); | 84 bounds.Inset(-buffer_pixels(), -buffer_pixels()); |
85 | 85 |
86 scoped_refptr<Picture> picture(Picture::Create( | 86 scoped_refptr<Picture> picture(Picture::Create( |
87 bounds, &client_, tile_grid_info_, true, 0, Picture::RECORD_NORMALLY)); | 87 bounds, &client_, tile_grid_info_, true, Picture::RECORD_NORMALLY)); |
88 picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); | 88 picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); |
89 EXPECT_TRUE(HasRecordingAt(x, y)); | 89 EXPECT_TRUE(HasRecordingAt(x, y)); |
90 | 90 |
91 has_any_recordings_ = true; | 91 has_any_recordings_ = true; |
92 } | 92 } |
93 | 93 |
94 void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { | 94 void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { |
95 EXPECT_GE(x, 0); | 95 EXPECT_GE(x, 0); |
96 EXPECT_GE(y, 0); | 96 EXPECT_GE(y, 0); |
97 EXPECT_LT(x, tiling_.num_tiles_x()); | 97 EXPECT_LT(x, tiling_.num_tiles_x()); |
98 EXPECT_LT(y, tiling_.num_tiles_y()); | 98 EXPECT_LT(y, tiling_.num_tiles_y()); |
99 | 99 |
100 if (!HasRecordingAt(x, y)) | 100 if (!HasRecordingAt(x, y)) |
101 return; | 101 return; |
102 picture_map_.erase(std::pair<int, int>(x, y)); | 102 picture_map_.erase(std::pair<int, int>(x, y)); |
103 EXPECT_FALSE(HasRecordingAt(x, y)); | 103 EXPECT_FALSE(HasRecordingAt(x, y)); |
104 } | 104 } |
105 | 105 |
106 void FakePicturePileImpl::RerecordPile() { | 106 void FakePicturePileImpl::RerecordPile() { |
107 for (int y = 0; y < num_tiles_y(); ++y) { | 107 for (int y = 0; y < num_tiles_y(); ++y) { |
108 for (int x = 0; x < num_tiles_x(); ++x) { | 108 for (int x = 0; x < num_tiles_x(); ++x) { |
109 RemoveRecordingAt(x, y); | 109 RemoveRecordingAt(x, y); |
110 AddRecordingAt(x, y); | 110 AddRecordingAt(x, y); |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 } // namespace cc | 115 } // namespace cc |
OLD | NEW |