| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "SkMergeImageFilter.h" | 34 #include "SkMergeImageFilter.h" |
| 35 #include "SkMorphologyImageFilter.h" | 35 #include "SkMorphologyImageFilter.h" |
| 36 #include "SkOffsetImageFilter.h" | 36 #include "SkOffsetImageFilter.h" |
| 37 #include "SkPaintImageFilter.h" | 37 #include "SkPaintImageFilter.h" |
| 38 #include "SkPerlinNoiseShader.h" | 38 #include "SkPerlinNoiseShader.h" |
| 39 #include "SkPictureImageFilter.h" | 39 #include "SkPictureImageFilter.h" |
| 40 #include "SkPictureRecorder.h" | 40 #include "SkPictureRecorder.h" |
| 41 #include "SkPoint3.h" | 41 #include "SkPoint3.h" |
| 42 #include "SkRandom.h" | 42 #include "SkRandom.h" |
| 43 #include "SkTableColorFilter.h" | 43 #include "SkTableColorFilter.h" |
| 44 #include "SkTestImageFilters.h" | |
| 45 #include "SkTileImageFilter.h" | 44 #include "SkTileImageFilter.h" |
| 46 #include "SkTypeface.h" | 45 #include "SkTypeface.h" |
| 47 #include "SkView.h" | 46 #include "SkView.h" |
| 48 #include "SkXfermodeImageFilter.h" | 47 #include "SkXfermodeImageFilter.h" |
| 49 #include <stdio.h> | 48 #include <stdio.h> |
| 50 #include <time.h> | 49 #include <time.h> |
| 51 | 50 |
| 52 //#define SK_ADD_RANDOM_BIT_FLIPS | 51 //#define SK_ADD_RANDOM_BIT_FLIPS |
| 53 //#define SK_FUZZER_IS_VERBOSE | 52 //#define SK_FUZZER_IS_VERBOSE |
| 54 | 53 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 537 |
| 539 static sk_sp<SkImageFilter> make_image_filter(bool canBeNull) { | 538 static sk_sp<SkImageFilter> make_image_filter(bool canBeNull) { |
| 540 sk_sp<SkImageFilter> filter; | 539 sk_sp<SkImageFilter> filter; |
| 541 | 540 |
| 542 // Add a 1 in 3 chance to get a nullptr input | 541 // Add a 1 in 3 chance to get a nullptr input |
| 543 if (canBeNull && (R(3) == 1)) { | 542 if (canBeNull && (R(3) == 1)) { |
| 544 return filter; | 543 return filter; |
| 545 } | 544 } |
| 546 | 545 |
| 547 enum { ALPHA_THRESHOLD, MERGE, COLOR, LUT3D, BLUR, MAGNIFIER, | 546 enum { ALPHA_THRESHOLD, MERGE, COLOR, LUT3D, BLUR, MAGNIFIER, |
| 548 DOWN_SAMPLE, XFERMODE, OFFSET, MATRIX, MATRIX_CONVOLUTION, COMPOSE, | 547 XFERMODE, OFFSET, MATRIX, MATRIX_CONVOLUTION, COMPOSE, |
| 549 DISTANT_LIGHT, POINT_LIGHT, SPOT_LIGHT, NOISE, DROP_SHADOW, | 548 DISTANT_LIGHT, POINT_LIGHT, SPOT_LIGHT, NOISE, DROP_SHADOW, |
| 550 MORPHOLOGY, BITMAP, DISPLACE, TILE, PICTURE, PAINT, NUM_FILTERS }; | 549 MORPHOLOGY, BITMAP, DISPLACE, TILE, PICTURE, PAINT, NUM_FILTERS }; |
| 551 | 550 |
| 552 switch (R(NUM_FILTERS)) { | 551 switch (R(NUM_FILTERS)) { |
| 553 case ALPHA_THRESHOLD: | 552 case ALPHA_THRESHOLD: |
| 554 filter = SkAlphaThresholdFilter::Make(make_region(), | 553 filter = SkAlphaThresholdFilter::Make(make_region(), |
| 555 make_scalar(), | 554 make_scalar(), |
| 556 make_scalar(), | 555 make_scalar(), |
| 557 make_image_filter()); | 556 make_image_filter()); |
| 558 break; | 557 break; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 578 case BLUR: | 577 case BLUR: |
| 579 filter = SkBlurImageFilter::Make(make_scalar(true), | 578 filter = SkBlurImageFilter::Make(make_scalar(true), |
| 580 make_scalar(true), | 579 make_scalar(true), |
| 581 make_image_filter()); | 580 make_image_filter()); |
| 582 break; | 581 break; |
| 583 case MAGNIFIER: | 582 case MAGNIFIER: |
| 584 filter = SkMagnifierImageFilter::Make(make_rect(), | 583 filter = SkMagnifierImageFilter::Make(make_rect(), |
| 585 make_scalar(true), | 584 make_scalar(true), |
| 586 make_image_filter()); | 585 make_image_filter()); |
| 587 break; | 586 break; |
| 588 case DOWN_SAMPLE: | |
| 589 filter = SkDownSampleImageFilter::Make(make_scalar(), make_image_filter(
)); | |
| 590 break; | |
| 591 case XFERMODE: | 587 case XFERMODE: |
| 592 filter = SkXfermodeImageFilter::Make(SkXfermode::Make(make_xfermode()), | 588 filter = SkXfermodeImageFilter::Make(SkXfermode::Make(make_xfermode()), |
| 593 make_image_filter(), | 589 make_image_filter(), |
| 594 make_image_filter(), | 590 make_image_filter(), |
| 595 nullptr); | 591 nullptr); |
| 596 break; | 592 break; |
| 597 case OFFSET: | 593 case OFFSET: |
| 598 filter = SkOffsetImageFilter::Make(make_scalar(), make_scalar(), make_im
age_filter()); | 594 filter = SkOffsetImageFilter::Make(make_scalar(), make_scalar(), make_im
age_filter()); |
| 599 break; | 595 break; |
| 600 case MATRIX: | 596 case MATRIX: |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 826 } |
| 831 | 827 |
| 832 private: | 828 private: |
| 833 typedef SkView INHERITED; | 829 typedef SkView INHERITED; |
| 834 }; | 830 }; |
| 835 | 831 |
| 836 ////////////////////////////////////////////////////////////////////////////// | 832 ////////////////////////////////////////////////////////////////////////////// |
| 837 | 833 |
| 838 static SkView* MyFactory() { return new ImageFilterFuzzView; } | 834 static SkView* MyFactory() { return new ImageFilterFuzzView; } |
| 839 static SkViewRegister reg(MyFactory); | 835 static SkViewRegister reg(MyFactory); |
| OLD | NEW |