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

Side by Side Diff: src/gpu/effects/GrMatrixConvolutionEffect.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/GrGammaEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.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 2014 Google Inc. 2 * Copyright 2014 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 GrMatrixConvolutionEffect_DEFINED 8 #ifndef GrMatrixConvolutionEffect_DEFINED
9 #define GrMatrixConvolutionEffect_DEFINED 9 #define GrMatrixConvolutionEffect_DEFINED
10 10
11 #include "GrSingleTextureEffect.h" 11 #include "GrSingleTextureEffect.h"
12 #include "GrInvariantOutput.h" 12 #include "GrInvariantOutput.h"
13 #include "GrTextureDomain.h" 13 #include "GrTextureDomain.h"
14 14
15 // A little bit less than the minimum # uniforms required by DX9SM2 (32). 15 // A little bit less than the minimum # uniforms required by DX9SM2 (32).
16 // Allows for a 5x5 kernel (or 25x1, for that matter). 16 // Allows for a 5x5 kernel (or 25x1, for that matter).
17 #define MAX_KERNEL_SIZE 25 17 #define MAX_KERNEL_SIZE 25
18 18
19 class GrMatrixConvolutionEffect : public GrSingleTextureEffect { 19 class GrMatrixConvolutionEffect : public GrSingleTextureEffect {
20 public: 20 public:
21 static GrFragmentProcessor* Create(GrTexture* texture, 21 static sk_sp<GrFragmentProcessor> Make(GrTexture* texture,
22 const SkIRect& bounds, 22 const SkIRect& bounds,
23 const SkISize& kernelSize, 23 const SkISize& kernelSize,
24 const SkScalar* kernel, 24 const SkScalar* kernel,
25 SkScalar gain, 25 SkScalar gain,
26 SkScalar bias, 26 SkScalar bias,
27 const SkIPoint& kernelOffset, 27 const SkIPoint& kernelOffset,
28 GrTextureDomain::Mode tileMode, 28 GrTextureDomain::Mode tileMode,
29 bool convolveAlpha) { 29 bool convolveAlpha) {
30 return new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel , gain, bias, 30 return sk_sp<GrFragmentProcessor>(
31 kernelOffset, tileMode, convolveAlp ha); 31 new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel, g ain, bias,
32 kernelOffset, tileMode, convolveAlpha) );
32 } 33 }
33 34
34 static GrFragmentProcessor* CreateGaussian(GrTexture* texture, 35 static sk_sp<GrFragmentProcessor> MakeGaussian(GrTexture* texture,
35 const SkIRect& bounds, 36 const SkIRect& bounds,
36 const SkISize& kernelSize, 37 const SkISize& kernelSize,
37 SkScalar gain, 38 SkScalar gain,
38 SkScalar bias, 39 SkScalar bias,
39 const SkIPoint& kernelOffset, 40 const SkIPoint& kernelOffset,
40 GrTextureDomain::Mode tileMode, 41 GrTextureDomain::Mode tileMod e,
41 bool convolveAlpha, 42 bool convolveAlpha,
42 SkScalar sigmaX, 43 SkScalar sigmaX,
43 SkScalar sigmaY); 44 SkScalar sigmaY);
44 45
45 const SkIRect& bounds() const { return fBounds; } 46 const SkIRect& bounds() const { return fBounds; }
46 const SkISize& kernelSize() const { return fKernelSize; } 47 const SkISize& kernelSize() const { return fKernelSize; }
47 const float* kernelOffset() const { return fKernelOffset; } 48 const float* kernelOffset() const { return fKernelOffset; }
48 const float* kernel() const { return fKernel; } 49 const float* kernel() const { return fKernel; }
49 float gain() const { return fGain; } 50 float gain() const { return fGain; }
50 float bias() const { return fBias; } 51 float bias() const { return fBias; }
51 bool convolveAlpha() const { return fConvolveAlpha; } 52 bool convolveAlpha() const { return fConvolveAlpha; }
52 const GrTextureDomain& domain() const { return fDomain; } 53 const GrTextureDomain& domain() const { return fDomain; }
53 54
(...skipping 29 matching lines...) Expand all
83 float fKernelOffset[2]; 84 float fKernelOffset[2];
84 bool fConvolveAlpha; 85 bool fConvolveAlpha;
85 GrTextureDomain fDomain; 86 GrTextureDomain fDomain;
86 87
87 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 88 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
88 89
89 typedef GrSingleTextureEffect INHERITED; 90 typedef GrSingleTextureEffect INHERITED;
90 }; 91 };
91 92
92 #endif 93 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrGammaEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698