caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 1 | #include "EdgeWalker_Test.h" |
| 2 | #include "Intersection_Tests.h" |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 3 | #include "SkBitmap.h" |
| 4 | |
| 5 | static SkBitmap bitmap; |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 6 | |
| 7 | static void testSimplifyTriangle() { |
| 8 | SkPath path, out; |
| 9 | path.setFillType(SkPath::kWinding_FillType); |
| 10 | path.moveTo(10,10); // triangle |\ . |
| 11 | path.lineTo(10,30); // |_\ . |
| 12 | path.lineTo(20,30); |
| 13 | path.close(); |
| 14 | path.moveTo(20,10); // triangle /| |
| 15 | path.lineTo(10,30); // /_| |
| 16 | path.lineTo(20,30); |
| 17 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 18 | testSimplify(path, true, out, bitmap); // expect |\/| |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 19 | // |__| |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | static void testSimplifyTriangle3() { |
| 23 | SkPath path, out; |
| 24 | path.moveTo(0, 0); |
| 25 | path.lineTo(1, 0); |
| 26 | path.lineTo(0, 1); |
| 27 | path.close(); |
| 28 | path.moveTo(0, 0); |
| 29 | path.lineTo(1, 0); |
| 30 | path.lineTo(3, 1); |
| 31 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 32 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | static void testSimplifyTriangle4() { |
| 36 | SkPath path, out; |
| 37 | path.moveTo(0, 0); |
| 38 | path.lineTo(1, 0); |
| 39 | path.lineTo(0, 1); |
| 40 | path.close(); |
| 41 | path.moveTo(0, 0); |
| 42 | path.lineTo(1, 0); |
| 43 | path.lineTo(2, 1); |
| 44 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 45 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | static void testSimplifyTriangle5() { |
| 49 | SkPath path, out; |
| 50 | path.moveTo(0, 0); |
| 51 | path.lineTo(1, 0); |
| 52 | path.lineTo(0, 1); |
| 53 | path.close(); |
| 54 | path.moveTo(0, 0); |
| 55 | path.lineTo(1, 1); |
| 56 | path.lineTo(2, 1); |
| 57 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 58 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static void testSimplifyTriangle6() { |
| 62 | SkPath path, out; |
| 63 | path.moveTo(0, 0); |
| 64 | path.lineTo(1, 0); |
| 65 | path.lineTo(0, 1); |
| 66 | path.lineTo(0, 0); |
| 67 | path.close(); |
| 68 | path.moveTo(0, 0); |
| 69 | path.lineTo(0, 1); |
| 70 | path.lineTo(3, 1); |
| 71 | path.lineTo(0, 0); |
| 72 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 73 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | static void testSimplifyTriangle7() { |
| 77 | SkPath path, out; |
| 78 | path.moveTo(0, 0); |
| 79 | path.lineTo(1, 0); |
| 80 | path.lineTo(0, 1); |
| 81 | path.lineTo(0, 0); |
| 82 | path.close(); |
| 83 | path.moveTo(0, 0); |
| 84 | path.lineTo(1, 1); |
| 85 | path.lineTo(0, 2); |
| 86 | path.lineTo(0, 0); |
| 87 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 88 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | static void testSimplifyTriangle8() { |
| 92 | SkPath path, out; |
| 93 | path.moveTo(0, 0); |
| 94 | path.lineTo(1, 0); |
| 95 | path.lineTo(0, 1); |
| 96 | path.lineTo(0, 0); |
| 97 | path.close(); |
| 98 | path.moveTo(0, 1); |
| 99 | path.lineTo(1, 2); |
| 100 | path.lineTo(1, 3); |
| 101 | path.lineTo(0, 1); |
| 102 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 103 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | static void testSimplifyTriangle9() { |
| 107 | SkPath path, out; |
| 108 | path.moveTo(0, 0); |
| 109 | path.lineTo(1, 0); |
| 110 | path.lineTo(1, 1); |
| 111 | path.lineTo(0, 0); |
| 112 | path.close(); |
| 113 | path.moveTo(0, 0); |
| 114 | path.lineTo(1, 1); |
| 115 | path.lineTo(2, 1); |
| 116 | path.lineTo(0, 0); |
| 117 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 118 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | static void testSimplifyTriangle10() { |
| 122 | SkPath path, out; |
| 123 | path.moveTo(0, 0); |
| 124 | path.lineTo(1, 0); |
| 125 | path.lineTo(1, 1); |
| 126 | path.lineTo(0, 0); |
| 127 | path.close(); |
| 128 | path.moveTo(0, 0); |
| 129 | path.lineTo(2, 0); |
| 130 | path.lineTo(0, 1); |
| 131 | path.lineTo(0, 0); |
| 132 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 133 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | static void testSimplifyTriangle11() { |
| 137 | SkPath path, out; |
| 138 | path.moveTo(0, 0); |
| 139 | path.lineTo(1, 0); |
| 140 | path.lineTo(0, 2); |
| 141 | path.lineTo(0, 0); |
| 142 | path.close(); |
| 143 | path.moveTo(0, 0); |
| 144 | path.lineTo(2, 1); |
| 145 | path.lineTo(2, 2); |
| 146 | path.lineTo(0, 0); |
| 147 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 148 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | static void testSimplifyTriangle12() { |
| 152 | SkPath path, out; |
| 153 | path.moveTo(0, 0); |
| 154 | path.lineTo(1, 0); |
| 155 | path.lineTo(1, 2); |
| 156 | path.lineTo(0, 0); |
| 157 | path.close(); |
| 158 | path.moveTo(2, 0); |
| 159 | path.lineTo(0, 3); |
| 160 | path.lineTo(1, 1); |
| 161 | path.lineTo(2, 0); |
| 162 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 163 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | static void testSimplifyTriangle13() { |
| 167 | SkPath path, out; |
| 168 | path.moveTo(0, 0); |
| 169 | path.lineTo(1, 0); |
| 170 | path.lineTo(0, 3); |
| 171 | path.lineTo(0, 0); |
| 172 | path.close(); |
| 173 | path.moveTo(3, 0); |
| 174 | path.lineTo(0, 3); |
| 175 | path.lineTo(1, 1); |
| 176 | path.lineTo(3, 0); |
| 177 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 178 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | static void testSimplifyTriangle14() { |
| 182 | SkPath path, out; |
| 183 | path.moveTo(0, 0); |
| 184 | path.lineTo(1, 0); |
| 185 | path.lineTo(0, 1); |
| 186 | path.lineTo(0, 0); |
| 187 | path.close(); |
| 188 | path.moveTo(0, 0); |
| 189 | path.lineTo(1, 0); |
| 190 | path.lineTo(0, 1); |
| 191 | path.lineTo(0, 0); |
| 192 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 193 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | static void testSimplifyTriangle15() { |
| 197 | SkPath path, out; |
| 198 | path.setFillType(SkPath::kEvenOdd_FillType); |
| 199 | path.moveTo(0, 0); |
| 200 | path.lineTo(0, 1); |
| 201 | path.lineTo(1, 2); |
| 202 | path.close(); |
| 203 | path.moveTo(0, 0); |
| 204 | path.lineTo(0, 1); |
| 205 | path.lineTo(2, 2); |
| 206 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 207 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | static void testSimplifyTriangle16() { |
| 211 | SkPath path, out; |
| 212 | path.moveTo(0, 0); |
| 213 | path.lineTo(0, 1); |
| 214 | path.lineTo(1, 2); |
| 215 | path.close(); |
| 216 | path.moveTo(0, 0); |
| 217 | path.lineTo(0, 1); |
| 218 | path.lineTo(1, 3); |
| 219 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 220 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | static void testSimplifyTriangle17() { |
| 224 | SkPath path, out; |
| 225 | path.moveTo(0, 0); |
| 226 | path.lineTo(0, 1); |
| 227 | path.lineTo(1, 2); |
| 228 | path.close(); |
| 229 | path.moveTo(0, 0); |
| 230 | path.lineTo(1, 3); |
| 231 | path.lineTo(0, 1); |
| 232 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 233 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 234 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 235 | |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 236 | static void testSimplifyTriangle18() { |
| 237 | SkPath path, out; |
| 238 | path.moveTo(0, 0); |
| 239 | path.lineTo(0, 1); |
| 240 | path.lineTo(1, 2); |
| 241 | path.close(); |
| 242 | path.moveTo(1, 0); |
| 243 | path.lineTo(0, 1); |
| 244 | path.lineTo(0, 3); |
| 245 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 246 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | static void testSimplifyTriangle19() { |
| 250 | SkPath path, out; |
| 251 | path.setFillType(SkPath::kEvenOdd_FillType); |
| 252 | path.moveTo(0, 0); |
| 253 | path.lineTo(0, 1); |
| 254 | path.lineTo(3, 2); |
| 255 | path.close(); |
| 256 | path.moveTo(0, 0); |
| 257 | path.lineTo(1, 1); |
| 258 | path.lineTo(2, 1); |
| 259 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 260 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | static void testSimplifyTriangle20() { |
| 264 | SkPath path, out; |
| 265 | path.moveTo(0, 0); |
| 266 | path.lineTo(2, 1); |
| 267 | path.lineTo(1, 3); |
| 268 | path.close(); |
| 269 | path.moveTo(2, 0); |
| 270 | path.lineTo(3, 2); |
| 271 | path.lineTo(0, 3); |
| 272 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 273 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | static void testSimplifyTriangle21() { |
| 277 | SkPath path, out; |
| 278 | path.moveTo(0, 0); |
| 279 | path.lineTo(1, 0); |
| 280 | path.lineTo(1, 2); |
| 281 | path.close(); |
| 282 | path.moveTo(2, 0); |
| 283 | path.lineTo(2, 1); |
| 284 | path.lineTo(0, 3); |
| 285 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 286 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | static void testSimplifyDegenerateTriangle1() { |
| 290 | SkPath path, out; |
| 291 | path.moveTo(0, 0); |
| 292 | path.lineTo(0, 0); |
| 293 | path.lineTo(0, 0); |
| 294 | path.close(); |
| 295 | path.moveTo(0, 0); |
| 296 | path.lineTo(0, 0); |
| 297 | path.lineTo(0, 0); |
| 298 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 299 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | static void testSimplifyDegenerateTriangle2() { |
| 303 | SkPath path, out; |
| 304 | path.moveTo(0, 0); |
| 305 | path.lineTo(1, 1); |
| 306 | path.lineTo(2, 2); |
| 307 | path.close(); |
| 308 | path.moveTo(1, 0); |
| 309 | path.lineTo(2, 2); |
| 310 | path.lineTo(3, 3); |
| 311 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 312 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 313 | } |
| 314 | |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 315 | static void testSimplifyWindingParallelogram() { |
| 316 | SkPath path, out; |
| 317 | path.setFillType(SkPath::kWinding_FillType); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 318 | path.moveTo(20,10); // parallelogram _ |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 319 | path.lineTo(30,30); // \ \ . |
| 320 | path.lineTo(40,30); // \_\ . |
| 321 | path.lineTo(30,10); |
| 322 | path.close(); |
| 323 | path.moveTo(20,10); // parallelogram _ |
| 324 | path.lineTo(10,30); // / / |
| 325 | path.lineTo(20,30); // /_/ |
| 326 | path.lineTo(30,10); |
| 327 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 328 | testSimplify(path, true, out, bitmap); // expect _ |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 329 | // / \ . |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 330 | } // /___\ . |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 331 | |
| 332 | static void testSimplifyXorParallelogram() { |
| 333 | SkPath path, out; |
| 334 | path.setFillType(SkPath::kEvenOdd_FillType); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 335 | path.moveTo(20,10); // parallelogram _ |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 336 | path.lineTo(30,30); // \ \ . |
| 337 | path.lineTo(40,30); // \_\ . |
| 338 | path.lineTo(30,10); |
| 339 | path.close(); |
| 340 | path.moveTo(20,10); // parallelogram _ |
| 341 | path.lineTo(10,30); // / / |
| 342 | path.lineTo(20,30); // /_/ |
| 343 | path.lineTo(30,10); |
| 344 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 345 | testSimplify(path, true, out, bitmap); // expect _ |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 346 | } // \ / |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 347 | |
| 348 | static void testSimplifyTriangle2() { |
| 349 | SkPath path, out; |
| 350 | path.setFillType(SkPath::kWinding_FillType); |
| 351 | path.moveTo(10,10); // triangle |\ . |
| 352 | path.lineTo(10,30); // |_\ . |
| 353 | path.lineTo(20,30); |
| 354 | path.close(); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame^] | 355 | path.moveTo(10,10); // triangle _ |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 356 | path.lineTo(20,10); // \ | |
| 357 | path.lineTo(20,30); // \| |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 358 | path.close(); // _ |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 359 | testSimplify(path, true, out, bitmap); // expect | | |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 360 | } // |_| |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 361 | |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 362 | #if 0 |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 363 | static void testPathTriangleRendering() { |
| 364 | SkPath one, two; |
| 365 | one.moveTo(0, 0); |
| 366 | one.lineTo(3, 3); |
| 367 | one.lineTo(0, 3); |
| 368 | one.lineTo(1, 2); |
| 369 | one.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 370 | for (float x = .1f; x <= 2.9ff; x += .1f) { |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 371 | SkDebugf("%s x=%g\n", __FUNCTION__, x); |
| 372 | two.moveTo(0, 0); |
| 373 | two.lineTo(x, x); |
| 374 | two.lineTo(3, 3); |
| 375 | two.lineTo(0, 3); |
| 376 | two.lineTo(1, 2); |
| 377 | two.close(); |
| 378 | comparePaths(one, two); |
| 379 | two.reset(); |
| 380 | } |
| 381 | } |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 382 | #endif |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 383 | |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 384 | static void simplify(const char* functionName, const SkPath& path, |
| 385 | bool fill, SkPath& out) { |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 386 | if (false) SkDebugf("%s\n", functionName); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 387 | simplify(path, fill, out); |
| 388 | } |
| 389 | |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 390 | static void testSimplifySkinnyTriangle1() { |
| 391 | for (int x = 1; x < 255; ++x) { |
| 392 | SkPath path, out; |
| 393 | path.moveTo((x * 101) % 10, 0); |
| 394 | path.lineTo((x * 91) % 10, 1000); |
| 395 | path.lineTo((x * 71) % 10, 2000); |
| 396 | path.lineTo((x * 51) % 10, 3000); |
| 397 | path.close(); |
| 398 | path.moveTo((x * 101) % 20, 0); |
| 399 | path.lineTo((x * 91) % 20, 1000); |
| 400 | path.lineTo((x * 71) % 20, 2000); |
| 401 | path.lineTo((x * 51) % 20, 3000); |
| 402 | path.close(); |
| 403 | path.moveTo((x * 101) % 30, 0); |
| 404 | path.lineTo((x * 91) % 30, 1000); |
| 405 | path.lineTo((x * 71) % 30, 2000); |
| 406 | path.lineTo((x * 51) % 30, 3000); |
| 407 | path.close(); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 408 | simplify(path, true, out); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | |
| 412 | static void testSimplifySkinnyTriangle2() { |
| 413 | SkPath path, out; |
| 414 | #if 01 |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 415 | path.moveTo(591.091064f, 627.534851f); |
| 416 | path.lineTo(541.088135f, 560.707642f); |
| 417 | path.lineTo(491.085175f, 493.880310f); |
| 418 | path.lineTo(441.082214f, 427.053101f); |
| 419 | //path.lineTo(591.091064f, 627.534851f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 420 | path.close(); |
| 421 | #endif |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 422 | path.moveTo(317.093445f, 592.013306f); |
| 423 | path.lineTo(366.316162f, 542.986572f); |
| 424 | path.lineTo(416.051514f, 486.978577f); |
| 425 | path.lineTo(465.786865f, 430.970581f); |
| 426 | //path.lineTo(317.093445f, 592.013306f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 427 | path.close(); |
| 428 | #if 0 |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 429 | path.moveTo(289.392517f, 517.138489f); |
| 430 | path.lineTo(249.886078f, 508.598022f); |
| 431 | path.lineTo(217.110916f, 450.916443f); |
| 432 | path.lineTo(196.621033f, 394.917633f); |
| 433 | //path.lineTo(289.392517f, 517.138489f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 434 | path.close(); |
| 435 | #endif |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 436 | simplify(__FUNCTION__, path, true, out); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | static void testSimplifySkinnyTriangle3() { |
| 440 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 441 | path.moveTo(591, 627.534851f); |
| 442 | path.lineTo(541, 560.707642f); |
| 443 | path.lineTo(491, 493.880310f); |
| 444 | path.lineTo(441, 427.053101f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 445 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 446 | path.moveTo(317, 592.013306f); |
| 447 | path.lineTo(366, 542.986572f); |
| 448 | path.lineTo(416, 486.978577f); |
| 449 | path.lineTo(465, 430.970581f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 450 | path.close(); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 451 | simplify(__FUNCTION__, path, true, out); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | static void testSimplifySkinnyTriangle4() { |
| 455 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 456 | path.moveTo(572.655212f, 614.959961f); |
| 457 | path.lineTo(524.618896f, 549.339600f); |
| 458 | path.lineTo(476.582581f, 483.719269f); |
| 459 | path.lineTo(428.546265f, 418.098938f); |
| 460 | path.lineTo(572.655212f, 614.959961f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 461 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 462 | path.moveTo(312.166382f, 583.723083f); |
| 463 | path.lineTo(361.047791f, 529.824219f); |
| 464 | path.lineTo(409.929230f, 475.925354f); |
| 465 | path.lineTo(458.810669f, 422.026520f); |
| 466 | path.lineTo(312.166382f, 583.723083f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 467 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 468 | path.moveTo(278.742737f, 508.065643f); |
| 469 | path.lineTo(241.475800f, 493.465118f); |
| 470 | path.lineTo(210.344177f, 437.315125f); |
| 471 | path.lineTo(197.019455f, 383.794556f); |
| 472 | path.lineTo(278.742737f, 508.065643f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 473 | path.close(); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 474 | simplify(__FUNCTION__, path, true, out); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | static void testSimplifySkinnyTriangle5() { |
| 478 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 479 | path.moveTo(554.690613f, 602.286072f); |
| 480 | path.lineTo(508.590057f, 537.906250f); |
| 481 | path.lineTo(462.489441f, 473.526520f); |
| 482 | path.lineTo(416.388855f, 409.146729f); |
| 483 | path.lineTo(554.690613f, 602.286072f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 484 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 485 | path.moveTo(307.216949f, 575.189270f); |
| 486 | path.lineTo(355.826965f, 516.804688f); |
| 487 | path.lineTo(403.815918f, 464.990753f); |
| 488 | path.lineTo(451.804871f, 413.176819f); |
| 489 | path.lineTo(307.216949f, 575.189270f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 490 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 491 | path.moveTo(271.998901f, 521.301025f); |
| 492 | path.lineTo(234.619705f, 499.687683f); |
| 493 | path.lineTo(203.059692f, 441.332336f); |
| 494 | path.lineTo(195.994370f, 386.856506f); |
| 495 | path.lineTo(271.998901f, 521.301025f); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 496 | path.close(); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 497 | simplify(__FUNCTION__, path, true, out); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 498 | } |
| 499 | |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 500 | static void testSimplifySkinnyTriangle6() { |
| 501 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 502 | path.moveTo(591.091064f, 627.534851f); |
| 503 | path.lineTo(541.088135f, 560.707642f); |
| 504 | path.lineTo(491.085175f, 493.880310f); |
| 505 | path.lineTo(441.082214f, 427.053101f); |
| 506 | path.lineTo(591.091064f, 627.534851f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 507 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 508 | path.moveTo(317.093445f, 592.013306f); |
| 509 | path.lineTo(366.316162f, 542.986572f); |
| 510 | path.lineTo(416.051514f, 486.978577f); |
| 511 | path.lineTo(465.786865f, 430.970581f); |
| 512 | path.lineTo(317.093445f, 592.013306f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 513 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 514 | path.moveTo(289.392517f, 517.138489f); |
| 515 | path.lineTo(249.886078f, 508.598022f); |
| 516 | path.lineTo(217.110916f, 450.916443f); |
| 517 | path.lineTo(196.621033f, 394.917633f); |
| 518 | path.lineTo(289.392517f, 517.138489f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 519 | path.close(); |
| 520 | simplify(__FUNCTION__, path, true, out); |
| 521 | } |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 522 | |
| 523 | static void testSimplifyTriangle22() { |
| 524 | SkPath path, out; |
| 525 | path.moveTo(0, 0); |
| 526 | path.lineTo(1, 0); |
| 527 | path.lineTo(0, 2); |
| 528 | path.close(); |
| 529 | path.moveTo(1, 0); |
| 530 | path.lineTo(0, 2); |
| 531 | path.lineTo(0, 1); |
| 532 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 533 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | static void testSimplifyTriangle23() { |
| 537 | SkPath path, out; |
| 538 | path.moveTo(0, 0); |
| 539 | path.lineTo(0, 0); |
| 540 | path.lineTo(0, 0); |
| 541 | path.close(); |
| 542 | path.moveTo(0, 0); |
| 543 | path.lineTo(0, 1); |
| 544 | path.lineTo(1, 2); |
| 545 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 546 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | static void testSimplifyTriangle24() { |
| 550 | SkPath path, out; |
| 551 | path.moveTo(0, 0); |
| 552 | path.lineTo(0, 0); |
| 553 | path.lineTo(0, 1); |
| 554 | path.close(); |
| 555 | path.moveTo(0, 0); |
| 556 | path.lineTo(1, 0); |
| 557 | path.lineTo(0, 1); |
| 558 | path.close(); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 559 | testSimplify(path, true, out, bitmap); |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 560 | } |
| 561 | |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 562 | static void testSimplifySkinnyTriangle7() { |
| 563 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 564 | path.moveTo(487.502319f, 550.811279f); |
| 565 | path.lineTo(448.826050f, 491.720123f); |
| 566 | path.lineTo(410.149780f, 432.628967f); |
| 567 | path.lineTo(371.473572f, 373.537781f); |
| 568 | path.lineTo(487.502319f, 550.811279f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 569 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 570 | path.moveTo(295.817108f, 532.655579f); |
| 571 | path.lineTo(342.896271f, 485.912292f); |
| 572 | path.lineTo(389.975433f, 439.169006f); |
| 573 | path.lineTo(437.054596f, 392.425781f); |
| 574 | path.lineTo(295.817108f, 532.655579f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 575 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 576 | path.moveTo(239.726822f, 575.025269f); |
| 577 | path.lineTo(204.117569f, 521.429688f); |
| 578 | path.lineTo(171.275452f, 454.110382f); |
| 579 | path.lineTo(193.328583f, 397.859497f); |
| 580 | path.lineTo(239.726822f, 575.025269f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 581 | path.close(); |
| 582 | simplify(__FUNCTION__, path, true, out); |
| 583 | } |
| 584 | |
| 585 | static void testSimplifySkinnyTriangle8() { |
| 586 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 587 | path.moveTo(441.943115f, 511.678040f); |
| 588 | path.lineTo(408.487549f, 456.880920f); |
| 589 | path.lineTo(375.031952f, 402.083801f); |
| 590 | path.lineTo(341.576385f, 347.286682f); |
| 591 | path.lineTo(441.943115f, 511.678040f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 592 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 593 | path.moveTo(297.548492f, 557.246704f); |
| 594 | path.lineTo(350.768494f, 507.627014f); |
| 595 | path.lineTo(403.988525f, 458.007385f); |
| 596 | path.lineTo(457.208527f, 408.387695f); |
| 597 | path.lineTo(297.548492f, 557.246704f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 598 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 599 | path.moveTo(209.857895f, 615.802979f); |
| 600 | path.lineTo(178.249481f, 534.230347f); |
| 601 | path.lineTo(144.905640f, 460.056824f); |
| 602 | path.lineTo(192.953125f, 404.972900f); |
| 603 | path.lineTo(209.857895f, 615.802979f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 604 | path.close(); |
| 605 | simplify(__FUNCTION__, path, true, out); |
| 606 | } |
| 607 | |
| 608 | static void testSimplifySkinnyTriangle9() { |
| 609 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 610 | path.moveTo(439.867065f, 528.291931f); |
| 611 | path.lineTo(405.413025f, 469.107178f); |
| 612 | path.lineTo(370.958954f, 409.922363f); |
| 613 | path.lineTo(336.504883f, 350.737610f); |
| 614 | path.lineTo(439.867065f, 528.291931f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 615 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 616 | path.moveTo(298.922455f, 573.251953f); |
| 617 | path.lineTo(356.360962f, 521.905090f); |
| 618 | path.lineTo(413.799438f, 470.558228f); |
| 619 | path.lineTo(471.237915f, 419.211365f); |
| 620 | path.lineTo(298.922455f, 573.251953f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 621 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 622 | path.moveTo(187.200775f, 643.035156f); |
| 623 | path.lineTo(159.713165f, 540.993774f); |
| 624 | path.lineTo(126.257164f, 462.198517f); |
| 625 | path.lineTo(193.534012f, 409.266235f); |
| 626 | path.lineTo(187.200775f, 643.035156f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 627 | path.close(); |
| 628 | path.close(); |
| 629 | simplify(__FUNCTION__, path, true, out); |
| 630 | } |
| 631 | |
| 632 | static void testSimplifySkinnyTriangle10() { |
| 633 | SkPath path, out; |
| 634 | #if 0 |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 635 | path.moveTo(99.270325f, 239.365234f); |
| 636 | path.lineTo(105.967056f, 173.361206f); |
| 637 | path.lineTo(148.821381f, 141.309891f); |
| 638 | path.lineTo(159.101013f, 189.235138f); |
| 639 | path.lineTo(99.270325f, 239.365234f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 640 | path.close(); |
| 641 | #endif |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 642 | path.moveTo(213.673737f, 413.292938f); |
| 643 | path.lineTo(225.200134f, 343.616821f); |
| 644 | path.lineTo(236.726532f, 273.940704f); |
| 645 | path.lineTo(219.386414f, 231.373322f); |
| 646 | path.lineTo(213.673737f, 413.292938f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 647 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 648 | path.moveTo(43.485352f, 308.984497f); |
| 649 | path.lineTo(122.610657f, 305.950134f); |
| 650 | path.lineTo(201.735962f, 302.915802f); |
| 651 | path.lineTo(280.861267f, 299.881470f); |
| 652 | path.lineTo(43.485352f, 308.984497f); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 653 | path.close(); |
| 654 | simplify(__FUNCTION__, path, true, out); |
| 655 | } |
| 656 | |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 657 | static void testSimplifySkinnyTriangle11() { |
| 658 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 659 | path.moveTo(-177.878387f, 265.368988f); |
| 660 | path.lineTo(-254.415771f, 303.709961f); |
| 661 | path.lineTo(-317.465363f, 271.325562f); |
| 662 | path.lineTo(-374.520386f, 207.507660f); |
| 663 | path.lineTo(-177.878387f, 265.368988f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 664 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 665 | path.moveTo(-63.582489f, -3.679123f); |
| 666 | path.lineTo(-134.496841f, 26.434566f); |
| 667 | path.lineTo(-205.411209f, 56.548256f); |
| 668 | path.lineTo(-276.325562f, 86.661942f); |
| 669 | path.lineTo(-63.582489f, -3.679123f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 670 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 671 | path.moveTo(-57.078423f, 162.633453f); |
| 672 | path.lineTo(-95.963928f, 106.261139f); |
| 673 | path.lineTo(-134.849457f, 49.888824f); |
| 674 | path.lineTo(-173.734955f, -6.483480f); |
| 675 | path.lineTo(-57.078423f, 162.633453f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 676 | path.close(); |
| 677 | simplify(__FUNCTION__, path, true, out); |
| 678 | } |
| 679 | |
| 680 | static void testSimplifySkinnyTriangle12() { |
| 681 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 682 | path.moveTo(98.666489f, -94.295059f); |
| 683 | path.lineTo(156.584320f, -61.939133f); |
| 684 | path.lineTo(174.672974f, -12.343765f); |
| 685 | path.lineTo(158.622345f, 52.028267f); |
| 686 | path.lineTo(98.666489f, -94.295059f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 687 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 688 | path.moveTo(-133.225616f, -48.622055f); |
| 689 | path.lineTo(-73.855499f, -10.375397f); |
| 690 | path.lineTo(-14.485367f, 27.871277f); |
| 691 | path.lineTo(44.884750f, 66.117935f); |
| 692 | path.lineTo(-133.225616f, -48.622055f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 693 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 694 | path.moveTo( 9.030045f, -163.413132f); |
| 695 | path.lineTo(-19.605331f, -89.588760f); |
| 696 | path.lineTo(-48.240707f, -15.764404f); |
| 697 | path.lineTo(-76.876053f, 58.059944f); |
| 698 | path.lineTo( 9.030045f, -163.413132f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 699 | path.close(); |
| 700 | simplify(__FUNCTION__, path, true, out); |
| 701 | } |
| 702 | |
| 703 | static void testSimplifySkinnyTriangle13() { |
| 704 | SkPath path, out; |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 705 | path.moveTo(340.41568f, -170.97171f); |
| 706 | path.lineTo(418.846893f, -142.428329f); |
| 707 | path.lineTo(497.278107f, -113.884933f); |
| 708 | path.lineTo(449.18222f, -45.6723022f); |
| 709 | path.lineTo(340.41568f, -170.97171f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 710 | path.close(); |
caryclark@google.com | b45a1b4 | 2012-05-18 20:50:33 +0000 | [diff] [blame] | 711 | path.moveTo(326.610535f, 34.0393639f); |
| 712 | path.lineTo(371.334595f, -14.9620667f); |
| 713 | path.lineTo(416.058624f, -63.9634857f); |
| 714 | path.lineTo(460.782654f, -112.96492f); |
| 715 | path.lineTo(326.610535f, 34.0393639f); |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 716 | path.close(); |
| 717 | simplify(__FUNCTION__, path, true, out); |
| 718 | } |
| 719 | |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 720 | static void (*simplifyTests[])() = { |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 721 | testSimplifySkinnyTriangle13, |
| 722 | testSimplifySkinnyTriangle12, |
| 723 | testSimplifySkinnyTriangle11, |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 724 | testSimplifySkinnyTriangle10, |
| 725 | testSimplifySkinnyTriangle9, |
| 726 | testSimplifySkinnyTriangle8, |
| 727 | testSimplifySkinnyTriangle7, |
| 728 | testSimplifySkinnyTriangle6, |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 729 | testSimplifySkinnyTriangle5, |
| 730 | testSimplifySkinnyTriangle4, |
| 731 | testSimplifySkinnyTriangle3, |
| 732 | testSimplifySkinnyTriangle2, |
| 733 | testSimplifySkinnyTriangle1, |
| 734 | testSimplifyTriangle24, |
| 735 | testSimplifyTriangle23, |
| 736 | testSimplifyTriangle22, |
caryclark@google.com | 4917f17 | 2012-03-05 22:01:21 +0000 | [diff] [blame] | 737 | testSimplifyDegenerateTriangle2, |
| 738 | testSimplifyDegenerateTriangle1, |
| 739 | testSimplifyTriangle21, |
| 740 | testSimplifyTriangle20, |
| 741 | testSimplifyTriangle19, |
| 742 | testSimplifyTriangle18, |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 743 | testSimplifyTriangle17, |
| 744 | testSimplifyTriangle16, |
| 745 | testSimplifyTriangle15, |
| 746 | testSimplifyTriangle14, |
| 747 | testSimplifyTriangle13, |
| 748 | testSimplifyTriangle12, |
| 749 | testSimplifyTriangle11, |
| 750 | testSimplifyTriangle10, |
| 751 | testSimplifyTriangle7, |
| 752 | testSimplifyTriangle9, |
| 753 | testSimplifyTriangle8, |
| 754 | testSimplifyTriangle6, |
| 755 | testSimplifyTriangle5, |
| 756 | testSimplifyTriangle4, |
| 757 | testSimplifyTriangle3, |
| 758 | testSimplifyTriangle, |
| 759 | testSimplifyTriangle2, |
| 760 | testSimplifyWindingParallelogram, |
| 761 | testSimplifyXorParallelogram, |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 762 | // testPathTriangleRendering, |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 763 | }; |
| 764 | |
| 765 | static size_t simplifyTestsCount = sizeof(simplifyTests) / sizeof(simplifyTests[0]); |
| 766 | |
caryclark@google.com | a576423 | 2012-03-28 16:20:21 +0000 | [diff] [blame] | 767 | static void (*firstTest)() = testSimplifySkinnyTriangle12; |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 768 | |
| 769 | void SimplifyPolygonPaths_Test() { |
| 770 | size_t index = 0; |
| 771 | if (firstTest) { |
| 772 | while (index < simplifyTestsCount && simplifyTests[index] != firstTest) { |
| 773 | ++index; |
| 774 | } |
| 775 | } |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 776 | bool firstTestComplete = false; |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 777 | for ( ; index < simplifyTestsCount; ++index) { |
| 778 | (*simplifyTests[index])(); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 779 | if (simplifyTests[index] == testSimplifySkinnyTriangle2) { |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 780 | if (false) SkDebugf("%s last fast skinny test\n", __FUNCTION__); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 781 | } |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 782 | firstTestComplete = true; |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 783 | } |
| 784 | } |
| 785 | |