Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: cc/paint/paint_op_buffer_unittest.cc

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, true); 486 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, true);
487 EXPECT_EQ(buffer->numSlowPaths(), 2); 487 EXPECT_EQ(buffer->numSlowPaths(), 2);
488 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, false); 488 buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, false);
489 EXPECT_EQ(buffer->numSlowPaths(), 2); 489 EXPECT_EQ(buffer->numSlowPaths(), 2);
490 490
491 // Drawing a record with slow paths into another adds the same 491 // Drawing a record with slow paths into another adds the same
492 // number of slow paths as the record. 492 // number of slow paths as the record.
493 auto buffer2 = sk_make_sp<PaintOpBuffer>(); 493 auto buffer2 = sk_make_sp<PaintOpBuffer>();
494 EXPECT_EQ(buffer2->numSlowPaths(), 0); 494 EXPECT_EQ(buffer2->numSlowPaths(), 0);
495 buffer2->push<DrawRecordOp>(buffer); 495 buffer2->push<DrawRecordOp>(buffer);
496 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths()); 496 EXPECT_EQ(buffer2->numSlowPaths(), 2);
497 buffer2->push<DrawRecordOp>(buffer);
498 EXPECT_EQ(buffer2->numSlowPaths(), 4);
499
500 // Drawing an empty display item list doesn't change anything.
501 auto empty_list = base::MakeRefCounted<DisplayItemList>();
502 buffer2->push<DrawDisplayItemListOp>(empty_list);
503 EXPECT_EQ(buffer2->numSlowPaths(), 4);
504
505 // Drawing a display item list adds the items from that list.
506 auto slow_path_list = base::MakeRefCounted<DisplayItemList>();
507 slow_path_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
508 gfx::Rect(1, 2, 3, 4), sk_make_sp<PaintOpBuffer>(),
509 SkRect::MakeXYWH(1, 2, 3, 4));
510 // Setting this properly is tested in PaintControllerTest.cpp.
511 slow_path_list->SetNumSlowPaths(50);
512 buffer2->push<DrawDisplayItemListOp>(slow_path_list);
513 EXPECT_EQ(buffer2->numSlowPaths(), 54);
497 } 514 }
498 515
499 } // namespace cc 516 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698