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

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

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: cleanup Created 6 years 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
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 class GrGLConvolutionEffect;
15
16 /** 14 /**
17 * 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
18 * + 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
19 * 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.
20 */ 18 */
21 class GrConvolutionEffect : public Gr1DKernelEffect { 19 class GrConvolutionEffect : public Gr1DKernelEffect {
22 20
23 public: 21 public:
24 22
25 /// Convolve with an arbitrary user-specified kernel 23 /// Convolve with an arbitrary user-specified kernel
(...skipping 26 matching lines...) Expand all
52 bounds)); 50 bounds));
53 } 51 }
54 52
55 virtual ~GrConvolutionEffect(); 53 virtual ~GrConvolutionEffect();
56 54
57 const float* kernel() const { return fKernel; } 55 const float* kernel() const { return fKernel; }
58 56
59 const float* bounds() const { return fBounds; } 57 const float* bounds() const { return fBounds; }
60 bool useBounds() const { return fUseBounds; } 58 bool useBounds() const { return fUseBounds; }
61 59
62 static const char* Name() { return "Convolution"; } 60 virtual const char* name() const SK_OVERRIDE { return "Convolution"; }
63 61
64 typedef GrGLConvolutionEffect GLProcessor; 62 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons t SK_OVERRIDE;
65 63
66 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 64 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
65
66 virtual uint32_t classID() const {
67 static uint32_t id = GenClassID();
68 return id;
69 }
67 70
68 enum { 71 enum {
69 // This was decided based on the min allowed value for the max texture 72 // This was decided based on the min allowed value for the max texture
70 // samples per fragment program run in DX9SM2 (32). A sigma param of 4.0 73 // samples per fragment program run in DX9SM2 (32). A sigma param of 4.0
71 // on a blur filter gives a kernel width of 25 while a sigma of 5.0 74 // on a blur filter gives a kernel width of 25 while a sigma of 5.0
72 // would exceed a 32 wide kernel. 75 // would exceed a 32 wide kernel.
73 kMaxKernelRadius = 12, 76 kMaxKernelRadius = 12,
74 // With a C++11 we could have a constexpr version of WidthFromRadius() 77 // With a C++11 we could have a constexpr version of WidthFromRadius()
75 // and not have to duplicate this calculation. 78 // and not have to duplicate this calculation.
76 kMaxKernelWidth = 2 * kMaxKernelRadius + 1, 79 kMaxKernelWidth = 2 * kMaxKernelRadius + 1,
(...skipping 26 matching lines...) Expand all
103 // kernel values. 106 // kernel values.
104 inout->mulByUnknownColor(); 107 inout->mulByUnknownColor();
105 } 108 }
106 109
107 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 110 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
108 111
109 typedef Gr1DKernelEffect INHERITED; 112 typedef Gr1DKernelEffect INHERITED;
110 }; 113 };
111 114
112 #endif 115 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698