OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 p.moveTo(SK_Scalar1*2, SK_Scalar1); | 2595 p.moveTo(SK_Scalar1*2, SK_Scalar1); |
2596 p.close(); | 2596 p.close(); |
2597 p.moveTo(SK_Scalar1*3, SK_Scalar1*2); | 2597 p.moveTo(SK_Scalar1*3, SK_Scalar1*2); |
2598 p.moveTo(SK_Scalar1*4, SK_Scalar1*3); | 2598 p.moveTo(SK_Scalar1*4, SK_Scalar1*3); |
2599 p.close(); | 2599 p.close(); |
2600 iter.setPath(p); | 2600 iter.setPath(p); |
2601 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); | 2601 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); |
2602 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1); | 2602 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1); |
2603 REPORTER_ASSERT(reporter, pts[0].fY == 0); | 2603 REPORTER_ASSERT(reporter, pts[0].fY == 0); |
2604 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); | 2604 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); |
2605 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1); | |
2606 REPORTER_ASSERT(reporter, pts[0].fY == 0); | |
2607 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); | 2605 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); |
2608 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2); | 2606 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2); |
2609 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1); | 2607 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1); |
2610 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); | 2608 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); |
2611 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2); | |
2612 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1); | |
2613 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); | 2609 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); |
2614 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*3); | 2610 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*3); |
2615 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*2); | 2611 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*2); |
2616 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); | 2612 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kMove_Verb); |
2617 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4); | 2613 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4); |
2618 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3); | 2614 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3); |
2619 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); | 2615 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kClose_Verb); |
2620 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4); | |
2621 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3); | |
2622 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb); | 2616 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb); |
2623 | 2617 |
2624 // Generate random paths and verify | 2618 // Generate random paths and verify |
2625 SkPoint randomPts[25]; | 2619 SkPoint randomPts[25]; |
2626 for (int i = 0; i < 5; ++i) { | 2620 for (int i = 0; i < 5; ++i) { |
2627 for (int j = 0; j < 5; ++j) { | 2621 for (int j = 0; j < 5; ++j) { |
2628 randomPts[i*5+j].set(SK_Scalar1*i, SK_Scalar1*j); | 2622 randomPts[i*5+j].set(SK_Scalar1*i, SK_Scalar1*j); |
2629 } | 2623 } |
2630 } | 2624 } |
2631 | 2625 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 case SkPath::kCubic_Verb: | 2748 case SkPath::kCubic_Verb: |
2755 REPORTER_ASSERT(reporter, numIterPts < numPoints + 3); | 2749 REPORTER_ASSERT(reporter, numIterPts < numPoints + 3); |
2756 REPORTER_ASSERT(reporter, pts[0] == lastPt); | 2750 REPORTER_ASSERT(reporter, pts[0] == lastPt); |
2757 REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts])
; | 2751 REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts])
; |
2758 REPORTER_ASSERT(reporter, pts[2] == expectedPts[numIterPts +
1]); | 2752 REPORTER_ASSERT(reporter, pts[2] == expectedPts[numIterPts +
1]); |
2759 REPORTER_ASSERT(reporter, pts[3] == expectedPts[numIterPts +
2]); | 2753 REPORTER_ASSERT(reporter, pts[3] == expectedPts[numIterPts +
2]); |
2760 lastPt = pts[3]; | 2754 lastPt = pts[3]; |
2761 numIterPts += 3; | 2755 numIterPts += 3; |
2762 break; | 2756 break; |
2763 case SkPath::kClose_Verb: | 2757 case SkPath::kClose_Verb: |
2764 REPORTER_ASSERT(reporter, pts[0] == lastMoveTo); | |
2765 lastPt = lastMoveTo; | 2758 lastPt = lastMoveTo; |
2766 break; | 2759 break; |
2767 default: | 2760 default: |
2768 SkDEBUGFAIL("unexpected verb"); | 2761 SkDEBUGFAIL("unexpected verb"); |
2769 } | 2762 } |
2770 } | 2763 } |
2771 REPORTER_ASSERT(reporter, numIterPts == numPoints); | 2764 REPORTER_ASSERT(reporter, numIterPts == numPoints); |
2772 REPORTER_ASSERT(reporter, numIterVerbs == numVerbs); | 2765 REPORTER_ASSERT(reporter, numIterVerbs == numVerbs); |
2773 } | 2766 } |
2774 } | 2767 } |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3780 test_get_point(reporter); | 3773 test_get_point(reporter); |
3781 test_contains(reporter); | 3774 test_contains(reporter); |
3782 PathTest_Private::TestPathTo(reporter); | 3775 PathTest_Private::TestPathTo(reporter); |
3783 PathRefTest_Private::TestPathRef(reporter); | 3776 PathRefTest_Private::TestPathRef(reporter); |
3784 test_dump(reporter); | 3777 test_dump(reporter); |
3785 test_path_crbug389050(reporter); | 3778 test_path_crbug389050(reporter); |
3786 test_path_crbugskia2820(reporter); | 3779 test_path_crbugskia2820(reporter); |
3787 test_skbug_3469(reporter); | 3780 test_skbug_3469(reporter); |
3788 test_skbug_3239(reporter); | 3781 test_skbug_3239(reporter); |
3789 } | 3782 } |
OLD | NEW |