Implement clone for 4 additional GrFragmentProcessors.
GrConfigConversionEffect
GrConstColorProcessor
GrConvexPolyEffect
AARectEffect
Change-Id: I3b103ed045db0825fc193ee7d6e61c8fe8e5c634
Reviewed-on: https://skia-review.googlesource.com/26842
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index fd01798..7dba3de 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -27,9 +27,11 @@
const char* name() const override { return "AARect"; }
- void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
+ sk_sp<GrFragmentProcessor> clone() const override { return Make(fEdgeType, fRect); }
private:
+ void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
+
AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect)
: INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRect(rect)
@@ -338,6 +340,18 @@
}
}
+GrConvexPolyEffect::GrConvexPolyEffect(const GrConvexPolyEffect& that)
+ : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ , fEdgeType(that.fEdgeType)
+ , fEdgeCount(that.fEdgeCount) {
+ this->initClassID<GrConvexPolyEffect>();
+ memcpy(fEdges, that.fEdges, 3 * that.fEdgeCount * sizeof(SkScalar));
+}
+
+sk_sp<GrFragmentProcessor> GrConvexPolyEffect::clone() const {
+ return sk_sp<GrFragmentProcessor>(new GrConvexPolyEffect(*this));
+}
+
bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const {
const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>();
// ignore the fact that 0 == -0 and just use memcmp.