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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 1817543002: Revert of switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) { 425 static SkPathEffect* make_path_effect(bool canBeNull = true) {
426 sk_sp<SkPathEffect> pathEffect; 426 SkPathEffect* pathEffect = nullptr;
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::Make(make_scalar(true)); 431 pathEffect = SkArcToPathEffect::Create(make_scalar(true));
432 break; 432 break;
433 case 1: 433 case 1: {
434 pathEffect = SkComposePathEffect::Make(make_path_effect(false), 434 SkAutoTUnref<SkPathEffect> outer(make_path_effect(false));
435 make_path_effect(false)); 435 SkAutoTUnref<SkPathEffect> inner(make_path_effect(false));
436 pathEffect = SkComposePathEffect::Create(outer, inner);
436 break; 437 break;
438 }
437 case 2: 439 case 2:
438 pathEffect = SkCornerPathEffect::Make(make_scalar()); 440 pathEffect = SkCornerPathEffect::Create(make_scalar());
439 break; 441 break;
440 case 3: { 442 case 3: {
441 int count = R(10); 443 int count = R(10);
442 SkScalar intervals[10]; 444 SkScalar intervals[10];
443 for (int i = 0; i < count; ++i) { 445 for (int i = 0; i < count; ++i) {
444 intervals[i] = make_scalar(); 446 intervals[i] = make_scalar();
445 } 447 }
446 pathEffect = SkDashPathEffect::Make(intervals, count, make_scalar()) ; 448 pathEffect = SkDashPathEffect::Create(intervals, count, make_scalar( ));
447 break; 449 break;
448 } 450 }
449 case 4: 451 case 4:
450 pathEffect = SkDiscretePathEffect::Make(make_scalar(), make_scalar() ); 452 pathEffect = SkDiscretePathEffect::Create(make_scalar(), make_scalar ());
451 break; 453 break;
452 case 5: 454 case 5:
453 pathEffect = SkPath1DPathEffect::Make(make_path(), make_scalar(), ma ke_scalar(), 455 pathEffect = SkPath1DPathEffect::Create(make_path(),
454 make_path_1d_path_effect_style ()); 456 make_scalar(),
457 make_scalar(),
458 make_path_1d_path_effect_sty le());
455 break; 459 break;
456 case 6: 460 case 6:
457 pathEffect = SkLine2DPathEffect::Make(make_scalar(), make_matrix()); 461 pathEffect = SkLine2DPathEffect::Create(make_scalar(), make_matrix() );
458 break; 462 break;
459 case 7: 463 case 7:
460 pathEffect = SkPath2DPathEffect::Make(make_matrix(), make_path()); 464 pathEffect = SkPath2DPathEffect::Create(make_matrix(), make_path());
461 break; 465 break;
462 case 8: 466 case 8:
463 default: 467 default:
464 pathEffect = SkSumPathEffect::Make(make_path_effect(false), 468 pathEffect = SkSumPathEffect::Create(make_path_effect(false),
465 make_path_effect(false)); 469 make_path_effect(false));
466 break; 470 break;
467 } 471 }
468 return pathEffect; 472 return pathEffect;
469 } 473 }
470 474
471 static SkMaskFilter* make_mask_filter() { 475 static SkMaskFilter* make_mask_filter() {
472 SkMaskFilter* maskFilter; 476 SkMaskFilter* maskFilter;
473 switch (R(3)) { 477 switch (R(3)) {
474 case 0: 478 case 0:
475 maskFilter = SkBlurMaskFilter::Create(make_blur_style(), 479 maskFilter = SkBlurMaskFilter::Create(make_blur_style(),
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 } 817 }
814 818
815 private: 819 private:
816 typedef SkView INHERITED; 820 typedef SkView INHERITED;
817 }; 821 };
818 822
819 ////////////////////////////////////////////////////////////////////////////// 823 //////////////////////////////////////////////////////////////////////////////
820 824
821 static SkView* MyFactory() { return new ImageFilterFuzzView; } 825 static SkView* MyFactory() { return new ImageFilterFuzzView; }
822 static SkViewRegister reg(MyFactory); 826 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