Index: include/gpu/GrFragmentProcessor.h |
diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h |
index c3f291cc5f53e510a1f43de582f0018745aaf7ee..b8ebeca30320b3f8a8e21e33e4a16395ef8d5bf2 100644 |
--- a/include/gpu/GrFragmentProcessor.h |
+++ b/include/gpu/GrFragmentProcessor.h |
@@ -31,29 +31,31 @@ public: |
* does so by returning a parent FP that multiplies the passed in FPs output by the parent's |
* input alpha. The passed in FP will not receive an input color. |
*/ |
- static const GrFragmentProcessor* MulOutputByInputAlpha(const GrFragmentProcessor*); |
+ static sk_sp<GrFragmentProcessor> MulOutputByInputAlpha(sk_sp<GrFragmentProcessor>); |
/** |
* Similar to the above but it modulates the output r,g,b of the child processor by the input |
* rgb and then multiplies all the components by the input alpha. This effectively modulates |
* the child processor's premul color by a unpremul'ed input and produces a premul output |
*/ |
- static const GrFragmentProcessor* MulOutputByInputUnpremulColor(const GrFragmentProcessor*); |
+ static sk_sp<GrFragmentProcessor> MulOutputByInputUnpremulColor(sk_sp<GrFragmentProcessor>); |
/** |
* Returns a parent fragment processor that adopts the passed fragment processor as a child. |
* The parent will ignore its input color and instead feed the passed in color as input to the |
* child. |
*/ |
- static const GrFragmentProcessor* OverrideInput(const GrFragmentProcessor*, GrColor); |
+ static sk_sp<GrFragmentProcessor> OverrideInput(sk_sp<GrFragmentProcessor>, GrColor); |
/** |
* Returns a fragment processor that runs the passed in array of fragment processors in a |
* series. The original input is passed to the first, the first's output is passed to the |
* second, etc. The output of the returned processor is the output of the last processor of the |
* series. |
+ * |
+ * The array elements with be moved. |
*/ |
- static const GrFragmentProcessor* RunInSeries(const GrFragmentProcessor*[], int cnt); |
+ static sk_sp<GrFragmentProcessor> RunInSeries(sk_sp<GrFragmentProcessor>*, int cnt); |
GrFragmentProcessor() |
: INHERITED() |
@@ -155,7 +157,7 @@ protected: |
* processors will allow the ProgramBuilder to automatically handle their transformed coords and |
* texture accesses and mangle their uniform and output color names. |
*/ |
- int registerChildProcessor(const GrFragmentProcessor* child); |
+ int registerChildProcessor(sk_sp<GrFragmentProcessor> child); |
/** |
* Subclass implements this to support getConstantColorComponents(...). |
@@ -187,7 +189,7 @@ private: |
bool hasSameTransforms(const GrFragmentProcessor&) const; |
- bool fUsesLocalCoords; |
+ bool fUsesLocalCoords; |
/** |
* fCoordTransforms stores the transforms of this proc, followed by all the transforms of this |
@@ -212,11 +214,16 @@ private: |
* |
* The same goes for fTextureAccesses with textures. |
*/ |
- SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
- int fNumTexturesExclChildren; |
- int fNumBuffersExclChildren; |
- int fNumTransformsExclChildren; |
- SkSTArray<1, const GrFragmentProcessor*, true> fChildProcessors; |
+ SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
+ int fNumTexturesExclChildren; |
+ int fNumBuffersExclChildren; |
+ int fNumTransformsExclChildren; |
+ |
+ /** |
+ * This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class holds strong |
+ * references until notifyRefCntIsZero and then it holds pending executions. |
+ */ |
+ SkSTArray<1, GrFragmentProcessor*, true> fChildProcessors; |
typedef GrProcessor INHERITED; |
}; |