OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/paint/paint_op_buffer.h" | 5 #include "cc/paint/paint_op_buffer.h" |
6 #include "cc/paint/display_item_list.h" | 6 #include "cc/paint/display_item_list.h" |
7 #include "cc/test/skia_common.h" | 7 #include "cc/test/skia_common.h" |
8 #include "cc/test/test_skcanvas.h" | 8 #include "cc/test/test_skcanvas.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/skia/include/effects/SkDashPathEffect.h" | 10 #include "third_party/skia/include/effects/SkDashPathEffect.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, true); | 516 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, true); |
517 EXPECT_EQ(buffer->numSlowPaths(), 2); | 517 EXPECT_EQ(buffer->numSlowPaths(), 2); |
518 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, false); | 518 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, false); |
519 EXPECT_EQ(buffer->numSlowPaths(), 2); | 519 EXPECT_EQ(buffer->numSlowPaths(), 2); |
520 | 520 |
521 // Drawing a record with slow paths into another adds the same | 521 // Drawing a record with slow paths into another adds the same |
522 // number of slow paths as the record. | 522 // number of slow paths as the record. |
523 auto buffer2 = sk_make_sp<PaintOpBuffer>(); | 523 auto buffer2 = sk_make_sp<PaintOpBuffer>(); |
524 EXPECT_EQ(buffer2->numSlowPaths(), 0); | 524 EXPECT_EQ(buffer2->numSlowPaths(), 0); |
525 buffer2->push<DrawRecordOp>(buffer); | 525 buffer2->push<DrawRecordOp>(buffer); |
526 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths()); | 526 EXPECT_EQ(buffer2->numSlowPaths(), 2); |
| 527 buffer2->push<DrawRecordOp>(buffer); |
| 528 EXPECT_EQ(buffer2->numSlowPaths(), 4); |
| 529 |
| 530 // Drawing an empty display item list doesn't change anything. |
| 531 auto empty_list = base::MakeShared<DisplayItemList>(); |
| 532 buffer2->push<DrawDisplayItemListOp>(empty_list); |
| 533 EXPECT_EQ(buffer2->numSlowPaths(), 4); |
| 534 |
| 535 // Drawing a display item list adds the items from that list. |
| 536 auto slow_path_list = base::MakeShared<DisplayItemList>(); |
| 537 slow_path_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( |
| 538 gfx::Rect(1, 2, 3, 4), sk_make_sp<PaintOpBuffer>(), |
| 539 SkRect::MakeXYWH(1, 2, 3, 4)); |
| 540 // Setting this properly is tested in PaintControllerTest.cpp. |
| 541 slow_path_list->SetNumSlowPaths(50); |
| 542 buffer2->push<DrawDisplayItemListOp>(slow_path_list); |
| 543 EXPECT_EQ(buffer2->numSlowPaths(), 54); |
527 } | 544 } |
528 | 545 |
529 } // namespace cc | 546 } // namespace cc |
OLD | NEW |