| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 break; | 454 break; |
| 455 case 8: | 455 case 8: |
| 456 default: | 456 default: |
| 457 pathEffect = SkSumPathEffect::Make(make_path_effect(false), | 457 pathEffect = SkSumPathEffect::Make(make_path_effect(false), |
| 458 make_path_effect(false)); | 458 make_path_effect(false)); |
| 459 break; | 459 break; |
| 460 } | 460 } |
| 461 return pathEffect; | 461 return pathEffect; |
| 462 } | 462 } |
| 463 | 463 |
| 464 static SkMaskFilter* make_mask_filter() { | 464 static sk_sp<SkMaskFilter> make_mask_filter() { |
| 465 SkMaskFilter* maskFilter; | 465 sk_sp<SkMaskFilter> maskFilter; |
| 466 switch (R(3)) { | 466 switch (R(3)) { |
| 467 case 0: | 467 case 0: |
| 468 maskFilter = SkBlurMaskFilter::Create(make_blur_style(), | 468 maskFilter = SkBlurMaskFilter::Make(make_blur_style(), make_scalar()
, |
| 469 make_scalar(), | 469 make_blur_mask_filter_flag()); |
| 470 make_blur_mask_filter_flag()); | |
| 471 case 1: { | 470 case 1: { |
| 472 SkEmbossMaskFilter::Light light; | 471 SkEmbossMaskFilter::Light light; |
| 473 for (int i = 0; i < 3; ++i) { | 472 for (int i = 0; i < 3; ++i) { |
| 474 light.fDirection[i] = make_scalar(); | 473 light.fDirection[i] = make_scalar(); |
| 475 } | 474 } |
| 476 light.fPad = R(65536); | 475 light.fPad = R(65536); |
| 477 light.fAmbient = R(256); | 476 light.fAmbient = R(256); |
| 478 light.fSpecular = R(256); | 477 light.fSpecular = R(256); |
| 479 maskFilter = SkEmbossMaskFilter::Create(make_scalar(), | 478 maskFilter = SkEmbossMaskFilter::Make(make_scalar(), light); |
| 480 light); | |
| 481 } | 479 } |
| 482 case 2: | 480 case 2: |
| 483 default: | 481 default: |
| 484 maskFilter = nullptr; | |
| 485 break; | 482 break; |
| 486 } | 483 } |
| 487 return maskFilter; | 484 return maskFilter; |
| 488 } | 485 } |
| 489 | 486 |
| 490 static sk_sp<SkImageFilter> make_image_filter(bool canBeNull = true); | 487 static sk_sp<SkImageFilter> make_image_filter(bool canBeNull = true); |
| 491 | 488 |
| 492 static SkPaint make_paint() { | 489 static SkPaint make_paint() { |
| 493 SkPaint paint; | 490 SkPaint paint; |
| 494 paint.setHinting(make_paint_hinting()); | 491 paint.setHinting(make_paint_hinting()); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 } | 862 } |
| 866 | 863 |
| 867 private: | 864 private: |
| 868 typedef SkView INHERITED; | 865 typedef SkView INHERITED; |
| 869 }; | 866 }; |
| 870 | 867 |
| 871 ////////////////////////////////////////////////////////////////////////////// | 868 ////////////////////////////////////////////////////////////////////////////// |
| 872 | 869 |
| 873 static SkView* MyFactory() { return new ImageFilterFuzzView; } | 870 static SkView* MyFactory() { return new ImageFilterFuzzView; } |
| 874 static SkViewRegister reg(MyFactory); | 871 static SkViewRegister reg(MyFactory); |
| OLD | NEW |