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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); | 300 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); |
301 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(40), SkPath::kCW_Direction); | 301 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(40), SkPath::kCW_Direction); |
302 canvas->drawPath(path2, paint); | 302 canvas->drawPath(path2, paint); |
303 | 303 |
304 path2.reset(); | 304 path2.reset(); |
305 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); | 305 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); |
306 canvas->drawPath(path2, paint); | 306 canvas->drawPath(path2, paint); |
307 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_First
Direction)); | 307 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_First
Direction)); |
308 | 308 |
309 path2.reset(); | 309 path2.reset(); |
310 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, NULL)); | 310 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, nullptr)); |
311 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); | 311 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); |
312 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstD
irection)); | 312 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstD
irection)); |
313 canvas->drawPath(path2, paint); | 313 canvas->drawPath(path2, paint); |
314 | 314 |
315 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), | 315 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), |
316 SkIntToScalar(100), SkIntToScalar(100)); | 316 SkIntToScalar(100), SkIntToScalar(100)); |
317 SkPath path3; | 317 SkPath path3; |
318 path3.setFillType(SkPath::kWinding_FillType); | 318 path3.setFillType(SkPath::kWinding_FillType); |
319 path3.addRect(r, SkPath::kCW_Direction); | 319 path3.addRect(r, SkPath::kCW_Direction); |
320 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 320 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
321 path3.addRect(r, SkPath::kCCW_Direction); | 321 path3.addRect(r, SkPath::kCCW_Direction); |
322 canvas->drawPath(path3, paint); | 322 canvas->drawPath(path3, paint); |
323 | 323 |
324 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), | 324 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), |
325 SkIntToScalar(100), SkIntToScalar(100)); | 325 SkIntToScalar(100), SkIntToScalar(100)); |
326 SkPath path4; | 326 SkPath path4; |
327 path4.setFillType(SkPath::kWinding_FillType); | 327 path4.setFillType(SkPath::kWinding_FillType); |
328 path4.addRect(r, SkPath::kCCW_Direction); | 328 path4.addRect(r, SkPath::kCCW_Direction); |
329 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 329 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
330 path4.addRect(r, SkPath::kCW_Direction); | 330 path4.addRect(r, SkPath::kCW_Direction); |
331 canvas->drawPath(path4, paint); | 331 canvas->drawPath(path4, paint); |
332 | 332 |
333 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), | 333 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), |
334 SkIntToScalar(100), SkIntToScalar(100)); | 334 SkIntToScalar(100), SkIntToScalar(100)); |
335 path4.reset(); | 335 path4.reset(); |
336 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); | 336 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); |
337 path4.addRect(r, SkPath::kCCW_Direction); | 337 path4.addRect(r, SkPath::kCCW_Direction); |
338 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_First
Direction)); | 338 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_First
Direction)); |
339 path4.moveTo(0, 0); // test for crbug.com/247770 | 339 path4.moveTo(0, 0); // test for crbug.com/247770 |
340 canvas->drawPath(path4, paint); | 340 canvas->drawPath(path4, paint); |
341 | 341 |
342 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), | 342 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), |
343 SkIntToScalar(100), SkIntToScalar(100)); | 343 SkIntToScalar(100), SkIntToScalar(100)); |
344 path4.reset(); | 344 path4.reset(); |
345 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); | 345 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); |
346 path4.addRect(r, SkPath::kCW_Direction); | 346 path4.addRect(r, SkPath::kCW_Direction); |
347 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstD
irection)); | 347 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstD
irection)); |
348 path4.moveTo(0, 0); // test for crbug.com/247770 | 348 path4.moveTo(0, 0); // test for crbug.com/247770 |
349 canvas->drawPath(path4, paint); | 349 canvas->drawPath(path4, paint); |
350 } | 350 } |
351 | 351 |
352 private: | 352 private: |
353 typedef GM INHERITED; | 353 typedef GM INHERITED; |
354 }; | 354 }; |
355 | 355 |
356 ////////////////////////////////////////////////////////////////////////////// | 356 ////////////////////////////////////////////////////////////////////////////// |
357 | 357 |
358 DEF_GM(return new StrokeFillGM;) | 358 DEF_GM(return new StrokeFillGM;) |
359 } | 359 } |
OLD | NEW |