| 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 stroke_tiny_cubic(); | 1069 stroke_tiny_cubic(); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 static void check_convexity(skiatest::Reporter* reporter, const SkPath& path, | 1072 static void check_convexity(skiatest::Reporter* reporter, const SkPath& path, |
| 1073 SkPath::Convexity expected) { | 1073 SkPath::Convexity expected) { |
| 1074 SkPath copy(path); // we make a copy so that we don't cache the result on th
e passed in path. | 1074 SkPath copy(path); // we make a copy so that we don't cache the result on th
e passed in path. |
| 1075 SkPath::Convexity c = copy.getConvexity(); | 1075 SkPath::Convexity c = copy.getConvexity(); |
| 1076 REPORTER_ASSERT(reporter, c == expected); | 1076 REPORTER_ASSERT(reporter, c == expected); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 static void test_path_crbug389050(skiatest::Reporter* reporter) { |
| 1080 SkPath tinyConvexPolygon; |
| 1081 tinyConvexPolygon.moveTo(600.131559f, 800.112512f); |
| 1082 tinyConvexPolygon.lineTo(600.161735f, 800.118627f); |
| 1083 tinyConvexPolygon.lineTo(600.148962f, 800.142338f); |
| 1084 tinyConvexPolygon.lineTo(600.134891f, 800.137724f); |
| 1085 tinyConvexPolygon.close(); |
| 1086 tinyConvexPolygon.getConvexity(); |
| 1087 check_convexity(reporter, tinyConvexPolygon, SkPath::kConvex_Convexity); |
| 1088 check_direction(reporter, tinyConvexPolygon, SkPath::kCW_Direction); |
| 1089 |
| 1090 SkPath platTriangle; |
| 1091 platTriangle.moveTo(0, 0); |
| 1092 platTriangle.lineTo(200, 0); |
| 1093 platTriangle.lineTo(100, 0.04f); |
| 1094 platTriangle.close(); |
| 1095 platTriangle.getConvexity(); |
| 1096 check_direction(reporter, platTriangle, SkPath::kCW_Direction); |
| 1097 |
| 1098 platTriangle.reset(); |
| 1099 platTriangle.moveTo(0, 0); |
| 1100 platTriangle.lineTo(200, 0); |
| 1101 platTriangle.lineTo(100, 0.03f); |
| 1102 platTriangle.close(); |
| 1103 platTriangle.getConvexity(); |
| 1104 check_direction(reporter, platTriangle, SkPath::kCW_Direction); |
| 1105 } |
| 1106 |
| 1079 static void test_convexity2(skiatest::Reporter* reporter) { | 1107 static void test_convexity2(skiatest::Reporter* reporter) { |
| 1080 SkPath pt; | 1108 SkPath pt; |
| 1081 pt.moveTo(0, 0); | 1109 pt.moveTo(0, 0); |
| 1082 pt.close(); | 1110 pt.close(); |
| 1083 check_convexity(reporter, pt, SkPath::kConvex_Convexity); | 1111 check_convexity(reporter, pt, SkPath::kConvex_Convexity); |
| 1084 check_direction(reporter, pt, SkPath::kUnknown_Direction); | 1112 check_direction(reporter, pt, SkPath::kUnknown_Direction); |
| 1085 | 1113 |
| 1086 SkPath line; | 1114 SkPath line; |
| 1087 line.moveTo(12*SK_Scalar1, 20*SK_Scalar1); | 1115 line.moveTo(12*SK_Scalar1, 20*SK_Scalar1); |
| 1088 line.lineTo(-12*SK_Scalar1, -20*SK_Scalar1); | 1116 line.lineTo(-12*SK_Scalar1, -20*SK_Scalar1); |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3732 test_addPathMode(reporter, true, true); | 3760 test_addPathMode(reporter, true, true); |
| 3733 test_extendClosedPath(reporter); | 3761 test_extendClosedPath(reporter); |
| 3734 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3762 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
| 3735 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3763 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
| 3736 test_conicTo_special_case(reporter); | 3764 test_conicTo_special_case(reporter); |
| 3737 test_get_point(reporter); | 3765 test_get_point(reporter); |
| 3738 test_contains(reporter); | 3766 test_contains(reporter); |
| 3739 PathTest_Private::TestPathTo(reporter); | 3767 PathTest_Private::TestPathTo(reporter); |
| 3740 PathRefTest_Private::TestPathRef(reporter); | 3768 PathRefTest_Private::TestPathRef(reporter); |
| 3741 test_dump(reporter); | 3769 test_dump(reporter); |
| 3770 test_path_crbug389050(reporter); |
| 3742 test_path_crbugskia2820(reporter); | 3771 test_path_crbugskia2820(reporter); |
| 3743 test_skbug_3469(reporter); | 3772 test_skbug_3469(reporter); |
| 3744 test_skbug_3239(reporter); | 3773 test_skbug_3239(reporter); |
| 3745 } | 3774 } |
| OLD | NEW |