Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 1869833002: Update MatrixConvolutionImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/imagefilters.cpp ('k') | gm/matrixconvolution.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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;)
OLDNEW
« no previous file with comments | « gm/imagefilters.cpp ('k') | gm/matrixconvolution.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698