OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 fGradientCircle = make_gradient_circle(64, 64); | 62 fGradientCircle = make_gradient_circle(64, 64); |
63 } | 63 } |
64 | 64 |
65 void onDraw(SkCanvas* canvas) override { | 65 void onDraw(SkCanvas* canvas) override { |
66 sk_sp<SkImageFilter> gradient(SkImageSource::Make(fGradientCircle)); | 66 sk_sp<SkImageFilter> gradient(SkImageSource::Make(fGradientCircle)); |
67 sk_sp<SkImageFilter> checkerboard(SkImageSource::Make(fCheckerboard)); | 67 sk_sp<SkImageFilter> checkerboard(SkImageSource::Make(fCheckerboard)); |
68 sk_sp<SkImageFilter> filters[] = { | 68 sk_sp<SkImageFilter> filters[] = { |
69 SkBlurImageFilter::Make(12, 0, nullptr), | 69 SkBlurImageFilter::Make(12, 0, nullptr), |
70 SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN, | 70 SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN, |
71 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nu
llptr), | 71 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nu
llptr), |
72 SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSel
ectorType, | 72 sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create( |
73 SkDisplacementMapEffect::kR_ChannelSel
ectorType, | 73 SkDisplacementMapEffect::kR_ChannelS
electorType, |
74 12, | 74 SkDisplacementMapEffect::kR_ChannelS
electorType, |
75 std::move(gradient), | 75 12, |
76 checkerboard), | 76 gradient.get(), |
| 77 checkerboard.get())), |
77 SkDilateImageFilter::Make(2, 2, checkerboard), | 78 SkDilateImageFilter::Make(2, 2, checkerboard), |
78 SkErodeImageFilter::Make(2, 2, checkerboard), | 79 SkErodeImageFilter::Make(2, 2, checkerboard), |
79 }; | 80 }; |
80 | 81 |
81 const SkScalar margin = SkIntToScalar(20); | 82 const SkScalar margin = SkIntToScalar(20); |
82 const SkScalar size = SkIntToScalar(60); | 83 const SkScalar size = SkIntToScalar(60); |
83 | 84 |
84 for (size_t j = 0; j < 3; j++) { | 85 for (size_t j = 0; j < 3; j++) { |
85 canvas->save(); | 86 canvas->save(); |
86 canvas->translate(margin, 0); | 87 canvas->translate(margin, 0); |
(...skipping 25 matching lines...) Expand all Loading... |
112 sk_sp<SkImage> fCheckerboard; | 113 sk_sp<SkImage> fCheckerboard; |
113 sk_sp<SkImage> fGradientCircle; | 114 sk_sp<SkImage> fGradientCircle; |
114 typedef GM INHERITED; | 115 typedef GM INHERITED; |
115 }; | 116 }; |
116 | 117 |
117 ////////////////////////////////////////////////////////////////////////////// | 118 ////////////////////////////////////////////////////////////////////////////// |
118 | 119 |
119 DEF_GM( return new ImageFiltersTransformedGM; ) | 120 DEF_GM( return new ImageFiltersTransformedGM; ) |
120 | 121 |
121 } | 122 } |
OLD | NEW |