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 <map> | 5 #include <map> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "cc/resources/picture_pile.h" | 8 #include "cc/resources/picture_pile.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 #include "cc/test/fake_rendering_stats_instrumentation.h" | 10 #include "cc/test/fake_rendering_stats_instrumentation.h" |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 client_.add_draw_rect(tiling_rect(), paint); | 1425 client_.add_draw_rect(tiling_rect(), paint); |
1426 client_.add_draw_rect(tiling_rect(), paint); | 1426 client_.add_draw_rect(tiling_rect(), paint); |
1427 client_.add_draw_rect(tiling_rect(), paint); | 1427 client_.add_draw_rect(tiling_rect(), paint); |
1428 client_.add_draw_rect(tiling_rect(), paint); | 1428 client_.add_draw_rect(tiling_rect(), paint); |
1429 client_.add_draw_rect(tiling_rect(), paint); | 1429 client_.add_draw_rect(tiling_rect(), paint); |
1430 Region invalidation5(tiling_rect()); | 1430 Region invalidation5(tiling_rect()); |
1431 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); | 1431 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); |
1432 EXPECT_FALSE(pile_.is_solid_color()); | 1432 EXPECT_FALSE(pile_.is_solid_color()); |
1433 } | 1433 } |
1434 | 1434 |
| 1435 TEST_F(PicturePileTest, NonSolidRectangleOnOffsettedLayerIsNonSolid) { |
| 1436 gfx::Rect visible_rect(tiling_rect()); |
| 1437 visible_rect.Offset(gfx::Vector2d(1000, 1000)); |
| 1438 // The picture pile requires that the tiling completely encompass the viewport |
| 1439 // to make this test work correctly since the recorded viewport is an |
| 1440 // intersection of the tile size and viewport rect. This is possibly a flaw |
| 1441 // in |PicturePile|. |
| 1442 gfx::Size tiling_size(visible_rect.right(), visible_rect.bottom()); |
| 1443 // |Setup()| will create pictures here that mess with the test, clear it! |
| 1444 pile_.Clear(); |
| 1445 |
| 1446 SkPaint paint; |
| 1447 paint.setColor(SK_ColorCYAN); |
| 1448 |
| 1449 // Add a rect that doesn't cover the viewport completely, the solid state |
| 1450 // will be false. |
| 1451 gfx::Rect smallRect = visible_rect; |
| 1452 smallRect.Inset(10, 10, 10, 10); |
| 1453 client_.add_draw_rect(smallRect, paint); |
| 1454 Region invalidation(visible_rect); |
| 1455 UpdateAndExpandInvalidation(&invalidation, tiling_size, visible_rect); |
| 1456 EXPECT_FALSE(pile_.is_solid_color()); |
| 1457 } |
| 1458 |
1435 } // namespace | 1459 } // namespace |
1436 } // namespace cc | 1460 } // namespace cc |
OLD | NEW |