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

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

Issue 1230813003: More threading of GrProcessorDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 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/GrConvolutionEffect.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 GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
22 GrTexture* texture,
22 const SkIRect& bounds, 23 const SkIRect& bounds,
23 const SkISize& kernelSize, 24 const SkISize& kernelSize,
24 const SkScalar* kernel, 25 const SkScalar* kernel,
25 SkScalar gain, 26 SkScalar gain,
26 SkScalar bias, 27 SkScalar bias,
27 const SkIPoint& kernelOffset, 28 const SkIPoint& kernelOffset,
28 GrTextureDomain::Mode tileMode, 29 GrTextureDomain::Mode tileMode,
29 bool convolveAlpha) { 30 bool convolveAlpha) {
30 return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture, 31 return SkNEW_ARGS(GrMatrixConvolutionEffect, (procDataManager,
32 texture,
31 bounds, 33 bounds,
32 kernelSize, 34 kernelSize,
33 kernel, 35 kernel,
34 gain, 36 gain,
35 bias, 37 bias,
36 kernelOffset, 38 kernelOffset,
37 tileMode, 39 tileMode,
38 convolveAlpha)); 40 convolveAlpha));
39 } 41 }
40 42
41 static GrFragmentProcessor* CreateGaussian(GrTexture* texture, 43 static GrFragmentProcessor* CreateGaussian(GrProcessorDataManager*,
44 GrTexture* texture,
42 const SkIRect& bounds, 45 const SkIRect& bounds,
43 const SkISize& kernelSize, 46 const SkISize& kernelSize,
44 SkScalar gain, 47 SkScalar gain,
45 SkScalar bias, 48 SkScalar bias,
46 const SkIPoint& kernelOffset, 49 const SkIPoint& kernelOffset,
47 GrTextureDomain::Mode tileMode, 50 GrTextureDomain::Mode tileMode,
48 bool convolveAlpha, 51 bool convolveAlpha,
49 SkScalar sigmaX, 52 SkScalar sigmaX,
50 SkScalar sigmaY); 53 SkScalar sigmaY);
51 54
52 virtual ~GrMatrixConvolutionEffect(); 55 virtual ~GrMatrixConvolutionEffect();
53 56
54 const SkIRect& bounds() const { return fBounds; } 57 const SkIRect& bounds() const { return fBounds; }
55 const SkISize& kernelSize() const { return fKernelSize; } 58 const SkISize& kernelSize() const { return fKernelSize; }
56 const float* kernelOffset() const { return fKernelOffset; } 59 const float* kernelOffset() const { return fKernelOffset; }
57 const float* kernel() const { return fKernel; } 60 const float* kernel() const { return fKernel; }
58 float gain() const { return fGain; } 61 float gain() const { return fGain; }
59 float bias() const { return fBias; } 62 float bias() const { return fBias; }
60 bool convolveAlpha() const { return fConvolveAlpha; } 63 bool convolveAlpha() const { return fConvolveAlpha; }
61 const GrTextureDomain& domain() const { return fDomain; } 64 const GrTextureDomain& domain() const { return fDomain; }
62 65
63 const char* name() const override { return "MatrixConvolution"; } 66 const char* name() const override { return "MatrixConvolution"; }
64 67
65 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const over ride; 68 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const over ride;
66 69
67 GrGLFragmentProcessor* createGLInstance() const override; 70 GrGLFragmentProcessor* createGLInstance() const override;
68 71
69 private: 72 private:
70 GrMatrixConvolutionEffect(GrTexture*, 73 GrMatrixConvolutionEffect(GrProcessorDataManager*,
74 GrTexture*,
71 const SkIRect& bounds, 75 const SkIRect& bounds,
72 const SkISize& kernelSize, 76 const SkISize& kernelSize,
73 const SkScalar* kernel, 77 const SkScalar* kernel,
74 SkScalar gain, 78 SkScalar gain,
75 SkScalar bias, 79 SkScalar bias,
76 const SkIPoint& kernelOffset, 80 const SkIPoint& kernelOffset,
77 GrTextureDomain::Mode tileMode, 81 GrTextureDomain::Mode tileMode,
78 bool convolveAlpha); 82 bool convolveAlpha);
79 83
80 bool onIsEqual(const GrFragmentProcessor&) const override; 84 bool onIsEqual(const GrFragmentProcessor&) const override;
(...skipping 11 matching lines...) Expand all
92 float fKernelOffset[2]; 96 float fKernelOffset[2];
93 bool fConvolveAlpha; 97 bool fConvolveAlpha;
94 GrTextureDomain fDomain; 98 GrTextureDomain fDomain;
95 99
96 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 100 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
97 101
98 typedef GrSingleTextureEffect INHERITED; 102 typedef GrSingleTextureEffect INHERITED;
99 }; 103 };
100 104
101 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvolutionEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698