Index: src/effects/gradients/SkLinearGradient.cpp |
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp |
index cdac5c8f5f01b2486a328ea4c5d9c270510f8d2c..872c6e81d100263c74a705a71b7aaa944feb229f 100644 |
--- a/src/effects/gradients/SkLinearGradient.cpp |
+++ b/src/effects/gradients/SkLinearGradient.cpp |
@@ -347,28 +347,9 @@ SkShader::GradientType SkLinearGradient::asAGradient(GradientInfo* info) const { |
///////////////////////////////////////////////////////////////////// |
-class GrGLLinearGradient : public GrGLGradientEffect { |
-public: |
- |
- GrGLLinearGradient(const GrProcessor&) {} |
- |
- virtual ~GrGLLinearGradient() { } |
- |
- virtual void emitCode(EmitArgs&) override; |
- |
- static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(processor)); |
- } |
- |
-private: |
- |
- typedef GrGLGradientEffect INHERITED; |
-}; |
- |
-///////////////////////////////////////////////////////////////////// |
- |
class GrLinearGradient : public GrGradientEffect { |
public: |
+ class GLSLLinearProcessor; |
static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, |
const SkLinearGradient& shader, |
@@ -390,14 +371,10 @@ private: |
this->initClassID<GrLinearGradient>(); |
} |
- GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
- return new GrGLLinearGradient(*this); |
- } |
+ GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
- GrProcessorKeyBuilder* b) const override { |
- GrGLLinearGradient::GenKey(*this, caps, b); |
- } |
+ GrProcessorKeyBuilder* b) const override; |
GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
@@ -406,6 +383,35 @@ private: |
///////////////////////////////////////////////////////////////////// |
+class GrLinearGradient::GLSLLinearProcessor : public GrGradientEffect::GLSLProcessor { |
+public: |
+ GLSLLinearProcessor(const GrProcessor&) {} |
+ |
+ virtual ~GLSLLinearProcessor() { } |
+ |
+ virtual void emitCode(EmitArgs&) override; |
+ |
+ static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { |
+ b->add32(GenBaseGradientKey(processor)); |
+ } |
+ |
+private: |
+ typedef GrGradientEffect::GLSLProcessor INHERITED; |
+}; |
+ |
+///////////////////////////////////////////////////////////////////// |
+ |
+GrGLSLFragmentProcessor* GrLinearGradient::onCreateGLSLInstance() const { |
+ return new GrLinearGradient::GLSLLinearProcessor(*this); |
+} |
+ |
+void GrLinearGradient::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
+ GrProcessorKeyBuilder* b) const { |
+ GrLinearGradient::GLSLLinearProcessor::GenKey(*this, caps, b); |
+} |
+ |
+///////////////////////////////////////////////////////////////////// |
+ |
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrLinearGradient); |
sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d) { |
@@ -428,7 +434,7 @@ sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d) |
///////////////////////////////////////////////////////////////////// |
-void GrGLLinearGradient::emitCode(EmitArgs& args) { |
+void GrLinearGradient::GLSLLinearProcessor::emitCode(EmitArgs& args) { |
const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); |
this->emitUniforms(args.fUniformHandler, ge); |
SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
@@ -436,7 +442,8 @@ void GrGLLinearGradient::emitCode(EmitArgs& args) { |
this->emitColor(args.fFragBuilder, |
args.fUniformHandler, |
args.fGLSLCaps, |
- ge, t.c_str(), |
+ ge, |
+ t.c_str(), |
args.fOutputColor, |
args.fInputColor, |
args.fTexSamplers); |