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 sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create( | 72 SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSel
ectorType, |
73 SkDisplacementMapEffect::kR_ChannelS
electorType, | 73 SkDisplacementMapEffect::kR_ChannelSel
ectorType, |
74 SkDisplacementMapEffect::kR_ChannelS
electorType, | 74 12, |
75 12, | 75 std::move(gradient), |
76 gradient.get(), | 76 checkerboard), |
77 checkerboard.get())), | |
78 SkDilateImageFilter::Make(2, 2, checkerboard), | 77 SkDilateImageFilter::Make(2, 2, checkerboard), |
79 SkErodeImageFilter::Make(2, 2, checkerboard), | 78 SkErodeImageFilter::Make(2, 2, checkerboard), |
80 }; | 79 }; |
81 | 80 |
82 const SkScalar margin = SkIntToScalar(20); | 81 const SkScalar margin = SkIntToScalar(20); |
83 const SkScalar size = SkIntToScalar(60); | 82 const SkScalar size = SkIntToScalar(60); |
84 | 83 |
85 for (size_t j = 0; j < 3; j++) { | 84 for (size_t j = 0; j < 3; j++) { |
86 canvas->save(); | 85 canvas->save(); |
87 canvas->translate(margin, 0); | 86 canvas->translate(margin, 0); |
(...skipping 25 matching lines...) Expand all Loading... |
113 sk_sp<SkImage> fCheckerboard; | 112 sk_sp<SkImage> fCheckerboard; |
114 sk_sp<SkImage> fGradientCircle; | 113 sk_sp<SkImage> fGradientCircle; |
115 typedef GM INHERITED; | 114 typedef GM INHERITED; |
116 }; | 115 }; |
117 | 116 |
118 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
119 | 118 |
120 DEF_GM( return new ImageFiltersTransformedGM; ) | 119 DEF_GM( return new ImageFiltersTransformedGM; ) |
121 | 120 |
122 } | 121 } |
OLD | NEW |