| OLD | NEW |
| 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 GrFragmentProcessor_DEFINED | 8 #ifndef GrFragmentProcessor_DEFINED |
| 9 #define GrFragmentProcessor_DEFINED | 9 #define GrFragmentProcessor_DEFINED |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * series. The original input is passed to the first, the first's output is
passed to the | 58 * series. The original input is passed to the first, the first's output is
passed to the |
| 59 * second, etc. The output of the returned processor is the output of the la
st processor of the | 59 * second, etc. The output of the returned processor is the output of the la
st processor of the |
| 60 * series. | 60 * series. |
| 61 * | 61 * |
| 62 * The array elements with be moved. | 62 * The array elements with be moved. |
| 63 */ | 63 */ |
| 64 static sk_sp<GrFragmentProcessor> RunInSeries(sk_sp<GrFragmentProcessor>*, i
nt cnt); | 64 static sk_sp<GrFragmentProcessor> RunInSeries(sk_sp<GrFragmentProcessor>*, i
nt cnt); |
| 65 | 65 |
| 66 GrFragmentProcessor() | 66 GrFragmentProcessor() |
| 67 : INHERITED() | 67 : INHERITED() |
| 68 , fUsesDistanceVectorField(false) |
| 68 , fUsesLocalCoords(false) | 69 , fUsesLocalCoords(false) |
| 69 , fNumTexturesExclChildren(0) | 70 , fNumTexturesExclChildren(0) |
| 70 , fNumBuffersExclChildren(0) | 71 , fNumBuffersExclChildren(0) |
| 71 , fNumTransformsExclChildren(0) {} | 72 , fNumTransformsExclChildren(0) {} |
| 72 | 73 |
| 73 ~GrFragmentProcessor() override; | 74 ~GrFragmentProcessor() override; |
| 74 | 75 |
| 75 GrGLSLFragmentProcessor* createGLSLInstance() const; | 76 GrGLSLFragmentProcessor* createGLSLInstance() const; |
| 76 | 77 |
| 77 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst { | 78 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 | 106 |
| 106 int numChildProcessors() const { return fChildProcessors.count(); } | 107 int numChildProcessors() const { return fChildProcessors.count(); } |
| 107 | 108 |
| 108 const GrFragmentProcessor& childProcessor(int index) const { return *fChildP
rocessors[index]; } | 109 const GrFragmentProcessor& childProcessor(int index) const { return *fChildP
rocessors[index]; } |
| 109 | 110 |
| 110 /** Do any of the coordtransforms for this processor require local coords? *
/ | 111 /** Do any of the coordtransforms for this processor require local coords? *
/ |
| 111 bool usesLocalCoords() const { return fUsesLocalCoords; } | 112 bool usesLocalCoords() const { return fUsesLocalCoords; } |
| 112 | 113 |
| 114 /** Does this FP need a vector to the nearest edge? */ |
| 115 bool usesDistanceVectorField() const { return fUsesDistanceVectorField; } |
| 116 |
| 113 /** Returns true if this and other processor conservatively draw identically
. It can only return | 117 /** Returns true if this and other processor conservatively draw identically
. It can only return |
| 114 true when the two processor are of the same subclass (i.e. they return t
he same object from | 118 true when the two processor are of the same subclass (i.e. they return t
he same object from |
| 115 from getFactory()). | 119 from getFactory()). |
| 116 | 120 |
| 117 A return value of true from isEqual() should not be used to test whether
the processor would | 121 A return value of true from isEqual() should not be used to test whether
the processor would |
| 118 generate the same shader code. To test for identical code generation use
getGLSLProcessorKey | 122 generate the same shader code. To test for identical code generation use
getGLSLProcessorKey |
| 119 */ | 123 */ |
| 120 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co
nst; | 124 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co
nst; |
| 121 | 125 |
| 122 /** | 126 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int registerChildProcessor(sk_sp<GrFragmentProcessor> child); | 170 int registerChildProcessor(sk_sp<GrFragmentProcessor> child); |
| 167 | 171 |
| 168 /** | 172 /** |
| 169 * Subclass implements this to support getConstantColorComponents(...). | 173 * Subclass implements this to support getConstantColorComponents(...). |
| 170 * | 174 * |
| 171 * Note: it's up to the subclass implementation to do any recursive call to
compute the child | 175 * Note: it's up to the subclass implementation to do any recursive call to
compute the child |
| 172 * procs' output invariants; computeInvariantOutput will not be recursive. | 176 * procs' output invariants; computeInvariantOutput will not be recursive. |
| 173 */ | 177 */ |
| 174 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; | 178 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; |
| 175 | 179 |
| 180 /* Sub-classes should set this to true in their constructors if they need ac
cess to a distance |
| 181 * vector field to the nearest edge |
| 182 */ |
| 183 bool fUsesDistanceVectorField; |
| 184 |
| 176 private: | 185 private: |
| 177 void notifyRefCntIsZero() const final; | 186 void notifyRefCntIsZero() const final; |
| 178 | 187 |
| 179 /** Returns a new instance of the appropriate *GL* implementation class | 188 /** Returns a new instance of the appropriate *GL* implementation class |
| 180 for the given GrFragmentProcessor; caller is responsible for deleting | 189 for the given GrFragmentProcessor; caller is responsible for deleting |
| 181 the object. */ | 190 the object. */ |
| 182 virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const = 0; | 191 virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const = 0; |
| 183 | 192 |
| 184 /** Implemented using GLFragmentProcessor::GenKey as described in this class
's comment. */ | 193 /** Implemented using GLFragmentProcessor::GenKey as described in this class
's comment. */ |
| 185 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, | 194 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 /** | 237 /** |
| 229 * This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class h
olds strong | 238 * This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class h
olds strong |
| 230 * references until notifyRefCntIsZero and then it holds pending executions. | 239 * references until notifyRefCntIsZero and then it holds pending executions. |
| 231 */ | 240 */ |
| 232 SkSTArray<1, GrFragmentProcessor*, true> fChildProcessors; | 241 SkSTArray<1, GrFragmentProcessor*, true> fChildProcessors; |
| 233 | 242 |
| 234 typedef GrProcessor INHERITED; | 243 typedef GrProcessor INHERITED; |
| 235 }; | 244 }; |
| 236 | 245 |
| 237 #endif | 246 #endif |
| OLD | NEW |