OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 | 8 |
9 #define TEST(name) { name, #name } | 9 #define TEST(name) { name, #name } |
10 | 10 |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 SkPath path, pathB; | 1137 SkPath path, pathB; |
1138 path.moveTo(1,3); | 1138 path.moveTo(1,3); |
1139 path.cubicTo(0,1, 3,1, 2,0); | 1139 path.cubicTo(0,1, 3,1, 2,0); |
1140 path.close(); | 1140 path.close(); |
1141 pathB.moveTo(1,3); | 1141 pathB.moveTo(1,3); |
1142 pathB.cubicTo(0,2, 3,1, 1,0); | 1142 pathB.cubicTo(0,2, 3,1, 1,0); |
1143 pathB.close(); | 1143 pathB.close(); |
1144 testPathOp(reporter, path, pathB, kDifference_PathOp); | 1144 testPathOp(reporter, path, pathB, kDifference_PathOp); |
1145 } | 1145 } |
1146 | 1146 |
| 1147 SkPathOp ops[] = { |
| 1148 kUnion_PathOp, |
| 1149 kXOR_PathOp, |
| 1150 kReverseDifference_PathOp, |
| 1151 kXOR_PathOp, |
| 1152 kReverseDifference_PathOp, |
| 1153 }; |
| 1154 |
| 1155 static void rRect1(skiatest::Reporter* reporter) { |
| 1156 SkScalar xA = SkFloatToScalar(0.65f); |
| 1157 SkScalar xB = SkFloatToScalar(10.65f); |
| 1158 SkScalar xC = SkFloatToScalar(20.65f); |
| 1159 SkScalar xD = SkFloatToScalar(30.65f); |
| 1160 SkScalar xE = SkFloatToScalar(40.65f); |
| 1161 SkScalar xF = SkFloatToScalar(50.65f); |
| 1162 |
| 1163 SkScalar yA = SkFloatToScalar(0.65f); |
| 1164 SkScalar yB = SkFloatToScalar(10.65f); |
| 1165 SkScalar yC = SkFloatToScalar(20.65f); |
| 1166 SkScalar yD = SkFloatToScalar(30.65f); |
| 1167 SkScalar yE = SkFloatToScalar(40.65f); |
| 1168 SkScalar yF = SkFloatToScalar(50.65f); |
| 1169 SkPath paths[5]; |
| 1170 SkRect rects[5]; |
| 1171 rects[0].set(xB, yB, xE, yE); |
| 1172 paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); //
red |
| 1173 rects[1].set(xA, yA, xD, yD); |
| 1174 paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); //
green |
| 1175 rects[2].set(xC, yA, xF, yD); |
| 1176 paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); //
blue |
| 1177 rects[3].set(xA, yC, xD, yF); |
| 1178 paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); //
yellow |
| 1179 rects[4].set(xC, yC, xF, yF); |
| 1180 paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); //
cyan |
| 1181 SkPath path; |
| 1182 path.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 1183 for (int index = 0; index < 5; ++index) { |
| 1184 testPathOp(reporter, path, paths[index], ops[index]); |
| 1185 Op(path, paths[index], ops[index], &path); |
| 1186 } |
| 1187 } |
| 1188 |
1147 static void (*firstTest)(skiatest::Reporter* ) = 0; | 1189 static void (*firstTest)(skiatest::Reporter* ) = 0; |
1148 | 1190 |
1149 static struct TestDesc tests[] = { | 1191 static struct TestDesc tests[] = { |
| 1192 TEST(rRect1), |
1150 TEST(cubicOp69d), | 1193 TEST(cubicOp69d), |
1151 TEST(cubicOp68u), | 1194 TEST(cubicOp68u), |
1152 TEST(cubicOp67u), | 1195 TEST(cubicOp67u), |
1153 TEST(cubicOp66u), | 1196 TEST(cubicOp66u), |
1154 TEST(rectOp1d), | 1197 TEST(rectOp1d), |
1155 TEST(cubicOp65d), | 1198 TEST(cubicOp65d), |
1156 TEST(cubicOp64d), | 1199 TEST(cubicOp64d), |
1157 TEST(cubicOp63d), | 1200 TEST(cubicOp63d), |
1158 TEST(cubicOp62d), | 1201 TEST(cubicOp62d), |
1159 TEST(cubicOp61d), | 1202 TEST(cubicOp61d), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 1326 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
1284 } | 1327 } |
1285 #ifdef SK_DEBUG | 1328 #ifdef SK_DEBUG |
1286 gDebugMaxWindSum = SK_MaxS32; | 1329 gDebugMaxWindSum = SK_MaxS32; |
1287 gDebugMaxWindValue = SK_MaxS32; | 1330 gDebugMaxWindValue = SK_MaxS32; |
1288 #endif | 1331 #endif |
1289 } | 1332 } |
1290 | 1333 |
1291 #include "TestClassDef.h" | 1334 #include "TestClassDef.h" |
1292 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) | 1335 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) |
OLD | NEW |