| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 EXPECT_GE(x, 0); | 76 EXPECT_GE(x, 0); |
| 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 bool can_use_lcd_text = false; |
| 87 bounds, &client_, tile_grid_info_, true, Picture::RECORD_NORMALLY)); | 87 bool contents_opaque = false; |
| 88 bool gather_pixel_refs = true; |
| 89 scoped_refptr<Picture> picture(Picture::Create(bounds, |
| 90 &client_, |
| 91 can_use_lcd_text, |
| 92 contents_opaque, |
| 93 tile_grid_info_, |
| 94 gather_pixel_refs, |
| 95 Picture::RECORD_NORMALLY)); |
| 88 picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); | 96 picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); |
| 89 EXPECT_TRUE(HasRecordingAt(x, y)); | 97 EXPECT_TRUE(HasRecordingAt(x, y)); |
| 90 | 98 |
| 91 has_any_recordings_ = true; | 99 has_any_recordings_ = true; |
| 92 } | 100 } |
| 93 | 101 |
| 94 void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { | 102 void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { |
| 95 EXPECT_GE(x, 0); | 103 EXPECT_GE(x, 0); |
| 96 EXPECT_GE(y, 0); | 104 EXPECT_GE(y, 0); |
| 97 EXPECT_LT(x, tiling_.num_tiles_x()); | 105 EXPECT_LT(x, tiling_.num_tiles_x()); |
| 98 EXPECT_LT(y, tiling_.num_tiles_y()); | 106 EXPECT_LT(y, tiling_.num_tiles_y()); |
| 99 | 107 |
| 100 if (!HasRecordingAt(x, y)) | 108 if (!HasRecordingAt(x, y)) |
| 101 return; | 109 return; |
| 102 picture_map_.erase(std::pair<int, int>(x, y)); | 110 picture_map_.erase(std::pair<int, int>(x, y)); |
| 103 EXPECT_FALSE(HasRecordingAt(x, y)); | 111 EXPECT_FALSE(HasRecordingAt(x, y)); |
| 104 } | 112 } |
| 105 | 113 |
| 106 void FakePicturePileImpl::RerecordPile() { | 114 void FakePicturePileImpl::RerecordPile() { |
| 107 for (int y = 0; y < num_tiles_y(); ++y) { | 115 for (int y = 0; y < num_tiles_y(); ++y) { |
| 108 for (int x = 0; x < num_tiles_x(); ++x) { | 116 for (int x = 0; x < num_tiles_x(); ++x) { |
| 109 RemoveRecordingAt(x, y); | 117 RemoveRecordingAt(x, y); |
| 110 AddRecordingAt(x, y); | 118 AddRecordingAt(x, y); |
| 111 } | 119 } |
| 112 } | 120 } |
| 113 } | 121 } |
| 114 | 122 |
| 115 } // namespace cc | 123 } // namespace cc |
| OLD | NEW |