Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SamplePath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SampleCode.h" 7 #include "SampleCode.h"
8 #include "Sk1DPathEffect.h" 8 #include "Sk1DPathEffect.h"
9 #include "Sk2DPathEffect.h" 9 #include "Sk2DPathEffect.h"
10 #include "SkAlphaThresholdFilter.h" 10 #include "SkAlphaThresholdFilter.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 default: 415 default:
416 path.arcTo(make_scalar(), make_scalar(), make_scalar(), make_sca lar(), make_scalar()); 416 path.arcTo(make_scalar(), make_scalar(), make_scalar(), make_sca lar(), make_scalar());
417 break; 417 break;
418 418
419 } 419 }
420 } 420 }
421 path.close(); 421 path.close();
422 return path; 422 return path;
423 } 423 }
424 424
425 static SkPathEffect* make_path_effect(bool canBeNull = true) { 425 static sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) {
426 SkPathEffect* pathEffect = nullptr; 426 sk_sp<SkPathEffect> pathEffect;
427 if (canBeNull && (R(3) == 1)) { return pathEffect; } 427 if (canBeNull && (R(3) == 1)) { return pathEffect; }
428 428
429 switch (R(9)) { 429 switch (R(9)) {
430 case 0: 430 case 0:
431 pathEffect = SkArcToPathEffect::Create(make_scalar(true)); 431 pathEffect = SkArcToPathEffect::Make(make_scalar(true));
432 break; 432 break;
433 case 1: { 433 case 1:
434 SkAutoTUnref<SkPathEffect> outer(make_path_effect(false)); 434 pathEffect = SkComposePathEffect::Make(make_path_effect(false),
435 SkAutoTUnref<SkPathEffect> inner(make_path_effect(false)); 435 make_path_effect(false));
436 pathEffect = SkComposePathEffect::Create(outer, inner);
437 break; 436 break;
438 }
439 case 2: 437 case 2:
440 pathEffect = SkCornerPathEffect::Create(make_scalar()); 438 pathEffect = SkCornerPathEffect::Make(make_scalar());
441 break; 439 break;
442 case 3: { 440 case 3: {
443 int count = R(10); 441 int count = R(10);
444 SkScalar intervals[10]; 442 SkScalar intervals[10];
445 for (int i = 0; i < count; ++i) { 443 for (int i = 0; i < count; ++i) {
446 intervals[i] = make_scalar(); 444 intervals[i] = make_scalar();
447 } 445 }
448 pathEffect = SkDashPathEffect::Create(intervals, count, make_scalar( )); 446 pathEffect = SkDashPathEffect::Make(intervals, count, make_scalar()) ;
449 break; 447 break;
450 } 448 }
451 case 4: 449 case 4:
452 pathEffect = SkDiscretePathEffect::Create(make_scalar(), make_scalar ()); 450 pathEffect = SkDiscretePathEffect::Make(make_scalar(), make_scalar() );
453 break; 451 break;
454 case 5: 452 case 5:
455 pathEffect = SkPath1DPathEffect::Create(make_path(), 453 pathEffect = SkPath1DPathEffect::Make(make_path(), make_scalar(), ma ke_scalar(),
456 make_scalar(), 454 make_path_1d_path_effect_style ());
457 make_scalar(),
458 make_path_1d_path_effect_sty le());
459 break; 455 break;
460 case 6: 456 case 6:
461 pathEffect = SkLine2DPathEffect::Create(make_scalar(), make_matrix() ); 457 pathEffect = SkLine2DPathEffect::Make(make_scalar(), make_matrix());
462 break; 458 break;
463 case 7: 459 case 7:
464 pathEffect = SkPath2DPathEffect::Create(make_matrix(), make_path()); 460 pathEffect = SkPath2DPathEffect::Make(make_matrix(), make_path());
465 break; 461 break;
466 case 8: 462 case 8:
467 default: 463 default:
468 pathEffect = SkSumPathEffect::Create(make_path_effect(false), 464 pathEffect = SkSumPathEffect::Make(make_path_effect(false),
469 make_path_effect(false)); 465 make_path_effect(false));
470 break; 466 break;
471 } 467 }
472 return pathEffect; 468 return pathEffect;
473 } 469 }
474 470
475 static SkMaskFilter* make_mask_filter() { 471 static SkMaskFilter* make_mask_filter() {
476 SkMaskFilter* maskFilter; 472 SkMaskFilter* maskFilter;
477 switch (R(3)) { 473 switch (R(3)) {
478 case 0: 474 case 0:
479 maskFilter = SkBlurMaskFilter::Create(make_blur_style(), 475 maskFilter = SkBlurMaskFilter::Create(make_blur_style(),
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 813 }
818 814
819 private: 815 private:
820 typedef SkView INHERITED; 816 typedef SkView INHERITED;
821 }; 817 };
822 818
823 ////////////////////////////////////////////////////////////////////////////// 819 //////////////////////////////////////////////////////////////////////////////
824 820
825 static SkView* MyFactory() { return new ImageFilterFuzzView; } 821 static SkView* MyFactory() { return new ImageFilterFuzzView; }
826 static SkViewRegister reg(MyFactory); 822 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SamplePath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698