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