OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 SkScalar kernel[9] = { | 209 SkScalar kernel[9] = { |
210 SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1), | 210 SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1), |
211 SkIntToScalar(-1), SkIntToScalar( 7 ), SkIntToScalar(-1), | 211 SkIntToScalar(-1), SkIntToScalar( 7 ), SkIntToScalar(-1), |
212 SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1), | 212 SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1), |
213 }; | 213 }; |
214 SkISize kernelSize = SkISize::Make(3, 3); | 214 SkISize kernelSize = SkISize::Make(3, 3); |
215 SkScalar gain = 1.0f, bias = SkIntToScalar(0); | 215 SkScalar gain = 1.0f, bias = SkIntToScalar(0); |
216 SkIPoint kernelOffset = SkIPoint::Make(1, 1); | 216 SkIPoint kernelOffset = SkIPoint::Make(1, 1); |
217 auto tileMode = SkMatrixConvolutionImageFilter::kClamp_TileMode; | 217 auto tileMode = SkMatrixConvolutionImageFilter::kClamp_TileMode; |
218 bool convolveAlpha = false; | 218 bool convolveAlpha = false; |
219 sk_sp<SkImageFilter> convolve( | 219 sk_sp<SkImageFilter> convolve(SkMatrixConvolutionImageFilter::Make(k
ernelSize, |
220 SkMatrixConvolutionImageFilter::Create(kernelSize, | 220 k
ernel, |
221 kernel, | 221 g
ain, |
222 gain, | 222 b
ias, |
223 bias, | 223 k
ernelOffset, |
224 kernelOffset, | 224 t
ileMode, |
225 tileMode, | 225 c
onvolveAlpha, |
226 convolveAlpha, | 226 s
td::move(dilate))); |
227 dilate.get())); | |
228 | 227 |
229 SkPaint paint; | 228 SkPaint paint; |
230 paint.setImageFilter(std::move(convolve)); | 229 paint.setImageFilter(std::move(convolve)); |
231 DrawClippedImage(canvas, fImage.get(), paint); | 230 DrawClippedImage(canvas, fImage.get(), paint); |
232 canvas->translate(SkIntToScalar(100), 0); | 231 canvas->translate(SkIntToScalar(100), 0); |
233 } | 232 } |
234 { | 233 { |
235 // Test that crop offsets are absolute, not relative to the parent's
crop rect. | 234 // Test that crop offsets are absolute, not relative to the parent's
crop rect. |
236 sk_sp<SkColorFilter> cf1(SkColorFilter::MakeModeFilter(SK_ColorBLUE, | 235 sk_sp<SkColorFilter> cf1(SkColorFilter::MakeModeFilter(SK_ColorBLUE, |
237 SkXfermode::k
SrcIn_Mode)); | 236 SkXfermode::k
SrcIn_Mode)); |
(...skipping 27 matching lines...) Expand all Loading... |
265 } | 264 } |
266 | 265 |
267 sk_sp<SkImage> fImage; | 266 sk_sp<SkImage> fImage; |
268 | 267 |
269 typedef GM INHERITED; | 268 typedef GM INHERITED; |
270 }; | 269 }; |
271 | 270 |
272 /////////////////////////////////////////////////////////////////////////////// | 271 /////////////////////////////////////////////////////////////////////////////// |
273 | 272 |
274 DEF_GM(return new ImageFiltersGraphGM;) | 273 DEF_GM(return new ImageFiltersGraphGM;) |
OLD | NEW |