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

Side by Side Diff: src/gpu/effects/GrConvolutionEffect.h

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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 | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrConvolutionEffect.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 #ifndef GrConvolutionEffect_DEFINED 8 #ifndef GrConvolutionEffect_DEFINED
9 #define GrConvolutionEffect_DEFINED 9 #define GrConvolutionEffect_DEFINED
10 10
11 #include "Gr1DKernelEffect.h" 11 #include "Gr1DKernelEffect.h"
12 #include "GrInvariantOutput.h" 12 #include "GrInvariantOutput.h"
13 13
14 /** 14 /**
15 * A convolution effect. The kernel is specified as an array of 2 * half-width 15 * A convolution effect. The kernel is specified as an array of 2 * half-width
16 * + 1 weights. Each texel is multiplied by it's weight and summed to determine 16 * + 1 weights. Each texel is multiplied by it's weight and summed to determine
17 * the output color. The output color is modulated by the input color. 17 * the output color. The output color is modulated by the input color.
18 */ 18 */
19 class GrConvolutionEffect : public Gr1DKernelEffect { 19 class GrConvolutionEffect : public Gr1DKernelEffect {
20 20
21 public: 21 public:
22 22
23 /// Convolve with an arbitrary user-specified kernel 23 /// Convolve with an arbitrary user-specified kernel
24 static GrFragmentProcessor* Create(GrTexture* tex, 24 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
25 Direction dir, 25 Direction dir,
26 int halfWidth, 26 int halfWidth,
27 const float* kernel, 27 const float* kernel,
28 bool useBounds, 28 bool useBounds,
29 float bounds[2]) { 29 float bounds[2]) {
30 return new GrConvolutionEffect(tex, dir, halfWidth, kernel, useBounds, b ounds); 30 return sk_sp<GrFragmentProcessor>(
31 new GrConvolutionEffect(tex, dir, halfWidth, kernel, useBounds, boun ds));
31 } 32 }
32 33
33 /// Convolve with a Gaussian kernel 34 /// Convolve with a Gaussian kernel
34 static GrFragmentProcessor* CreateGaussian(GrTexture* tex, 35 static sk_sp<GrFragmentProcessor> MakeGaussian(GrTexture* tex,
35 Direction dir, 36 Direction dir,
36 int halfWidth, 37 int halfWidth,
37 float gaussianSigma, 38 float gaussianSigma,
38 bool useBounds, 39 bool useBounds,
39 float bounds[2]) { 40 float bounds[2]) {
40 return new GrConvolutionEffect(tex, dir, halfWidth, gaussianSigma, useBo unds, bounds); 41 return sk_sp<GrFragmentProcessor>(
42 new GrConvolutionEffect(tex, dir, halfWidth, gaussianSigma, useBound s, bounds));
41 } 43 }
42 44
43 virtual ~GrConvolutionEffect(); 45 virtual ~GrConvolutionEffect();
44 46
45 const float* kernel() const { return fKernel; } 47 const float* kernel() const { return fKernel; }
46 48
47 const float* bounds() const { return fBounds; } 49 const float* bounds() const { return fBounds; }
48 bool useBounds() const { return fUseBounds; } 50 bool useBounds() const { return fUseBounds; }
49 51
50 const char* name() const override { return "Convolution"; } 52 const char* name() const override { return "Convolution"; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // kernel values. 93 // kernel values.
92 inout->mulByUnknownFourComponents(); 94 inout->mulByUnknownFourComponents();
93 } 95 }
94 96
95 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 97 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
96 98
97 typedef Gr1DKernelEffect INHERITED; 99 typedef Gr1DKernelEffect INHERITED;
98 }; 100 };
99 101
100 #endif 102 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698