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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 active_pile->add_draw_rect(rect); | 261 active_pile->add_draw_rect(rect); |
262 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1)); | 262 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1)); |
263 } | 263 } |
264 // Force re-record with newly injected content | 264 // Force re-record with newly injected content |
265 active_pile->RemoveRecordingAt(0, 0); | 265 active_pile->RemoveRecordingAt(0, 0); |
266 active_pile->AddRecordingAt(0, 0); | 266 active_pile->AddRecordingAt(0, 0); |
267 | 267 |
268 std::vector<SkRect>::const_iterator rect_iter = rects.begin(); | 268 std::vector<SkRect>::const_iterator rect_iter = rects.begin(); |
269 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { | 269 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { |
270 MockCanvas mock_canvas(1000, 1000); | 270 MockCanvas mock_canvas(1000, 1000); |
271 active_pile->RasterDirect( | 271 active_pile->RasterDirect(&mock_canvas, (*tile_iter)->content_rect(), |
272 &mock_canvas, (*tile_iter)->content_rect(), 1.0f, nullptr); | 272 1.0f); |
273 | 273 |
274 // This test verifies that when drawing the contents of a specific tile | 274 // This test verifies that when drawing the contents of a specific tile |
275 // at content scale 1.0, the playback canvas never receives content from | 275 // at content scale 1.0, the playback canvas never receives content from |
276 // neighboring tiles which indicates that the tile grid embedded in | 276 // neighboring tiles which indicates that the tile grid embedded in |
277 // SkPicture is perfectly aligned with the compositor's tiles. | 277 // SkPicture is perfectly aligned with the compositor's tiles. |
278 EXPECT_EQ(1u, mock_canvas.rects_.size()); | 278 EXPECT_EQ(1u, mock_canvas.rects_.size()); |
279 EXPECT_EQ(*rect_iter, mock_canvas.rects_[0]); | 279 EXPECT_EQ(*rect_iter, mock_canvas.rects_[0]); |
280 rect_iter++; | 280 rect_iter++; |
281 } | 281 } |
282 } | 282 } |
(...skipping 4453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4736 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4736 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4737 EXPECT_EQ(result.width(), 448); | 4737 EXPECT_EQ(result.width(), 448); |
4738 EXPECT_EQ(result.height(), 448); | 4738 EXPECT_EQ(result.height(), 448); |
4739 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4739 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4740 EXPECT_EQ(result.width(), 512); | 4740 EXPECT_EQ(result.width(), 512); |
4741 EXPECT_EQ(result.height(), 500 + 2); | 4741 EXPECT_EQ(result.height(), 500 + 2); |
4742 } | 4742 } |
4743 | 4743 |
4744 } // namespace | 4744 } // namespace |
4745 } // namespace cc | 4745 } // namespace cc |
OLD | NEW |