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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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/GrConfigConversionEffect.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 GrFragmentProcessor* Create(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], GrRenderTarget* dst) {
30 return new GrConvolutionEffect(tex, dir, halfWidth, kernel, useBounds, b ounds); 30 return new GrConvolutionEffect(tex, dir, halfWidth, kernel, useBounds, b ounds, dst);
31 } 31 }
32 32
33 /// Convolve with a Gaussian kernel 33 /// Convolve with a Gaussian kernel
34 static GrFragmentProcessor* CreateGaussian(GrTexture* tex, 34 static GrFragmentProcessor* CreateGaussian(GrTexture* tex,
35 Direction dir, 35 Direction dir,
36 int halfWidth, 36 int halfWidth,
37 float gaussianSigma, 37 float gaussianSigma,
38 bool useBounds, 38 bool useBounds,
39 float bounds[2]) { 39 float bounds[2], GrRenderTarget* dst) {
40 return new GrConvolutionEffect(tex, dir, halfWidth, gaussianSigma, useBo unds, bounds); 40 return new GrConvolutionEffect(tex, dir, halfWidth, gaussianSigma,
41 useBounds, bounds, dst);
41 } 42 }
42 43
43 virtual ~GrConvolutionEffect(); 44 virtual ~GrConvolutionEffect();
44 45
45 const float* kernel() const { return fKernel; } 46 const float* kernel() const { return fKernel; }
46 47
47 const float* bounds() const { return fBounds; } 48 const float* bounds() const { return fBounds; }
48 bool useBounds() const { return fUseBounds; } 49 bool useBounds() const { return fUseBounds; }
49 50
50 const char* name() const override { return "Convolution"; } 51 const char* name() const override { return "Convolution"; }
(...skipping 13 matching lines...) Expand all
64 65
65 float fKernel[kMaxKernelWidth]; 66 float fKernel[kMaxKernelWidth];
66 bool fUseBounds; 67 bool fUseBounds;
67 float fBounds[2]; 68 float fBounds[2];
68 69
69 private: 70 private:
70 GrConvolutionEffect(GrTexture*, Direction, 71 GrConvolutionEffect(GrTexture*, Direction,
71 int halfWidth, 72 int halfWidth,
72 const float* kernel, 73 const float* kernel,
73 bool useBounds, 74 bool useBounds,
74 float bounds[2]); 75 float bounds[2], GrRenderTarget* dst);
75 76
76 /// Convolve with a Gaussian kernel 77 /// Convolve with a Gaussian kernel
77 GrConvolutionEffect(GrTexture*, Direction, 78 GrConvolutionEffect(GrTexture*, Direction,
78 int halfWidth, 79 int halfWidth,
79 float gaussianSigma, 80 float gaussianSigma,
80 bool useBounds, 81 bool useBounds,
81 float bounds[2]); 82 float bounds[2], GrRenderTarget* dst);
82 83
83 GrGLFragmentProcessor* onCreateGLInstance() const override; 84 GrGLFragmentProcessor* onCreateGLInstance() const override;
84 85
85 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 86 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride;
86 87
87 bool onIsEqual(const GrFragmentProcessor&) const override; 88 bool onIsEqual(const GrFragmentProcessor&) const override;
88 89
89 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { 90 void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
90 // If the texture was opaque we could know that the output color if we k new the sum of the 91 // If the texture was opaque we could know that the output color if we k new the sum of the
91 // kernel values. 92 // kernel values.
92 inout->mulByUnknownFourComponents(); 93 inout->mulByUnknownFourComponents();
93 } 94 }
94 95
95 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 96 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
96 97
97 typedef Gr1DKernelEffect INHERITED; 98 typedef Gr1DKernelEffect INHERITED;
98 }; 99 };
99 100
100 #endif 101 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698