Patch to create a distinct geometry processor. The vast majority of this patch
is just a rename. The meat is in GrGeometryProcessor, GrProcessor,
GrGL*Processor, GrProcessorStage, Gr*BackendProcessorFactory,
GrProcessUnitTestFactory, and the builders
BUG=skia:
R=bsalomon@google.com
Author: joshualitt@chromium.org
Review URL: https://codereview.chromium.org/582963002
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 90d9458..b4ced5e 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -469,27 +469,27 @@
#if SK_SUPPORT_GPU
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "gl/builders/GrGLProgramBuilder.h"
#include "SkGr.h"
class GrGLRadialGradient : public GrGLGradientEffect {
public:
- GrGLRadialGradient(const GrBackendEffectFactory& factory,
- const GrEffect&) : INHERITED (factory) { }
+ GrGLRadialGradient(const GrBackendProcessorFactory& factory,
+ const GrProcessor&) : INHERITED (factory) { }
virtual ~GrGLRadialGradient() { }
virtual void emitCode(GrGLProgramBuilder*,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static void GenKey(const GrEffect& effect, const GrGLCaps&, GrEffectKeyBuilder* b) {
- b->add32(GenBaseGradientKey(effect));
+ static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcessorKeyBuilder* b) {
+ b->add32(GenBaseGradientKey(processor));
}
private:
@@ -502,21 +502,21 @@
class GrRadialGradient : public GrGradientEffect {
public:
- static GrEffect* Create(GrContext* ctx,
- const SkRadialGradient& shader,
- const SkMatrix& matrix,
- SkShader::TileMode tm) {
+ static GrFragmentProcessor* Create(GrContext* ctx,
+ const SkRadialGradient& shader,
+ const SkMatrix& matrix,
+ SkShader::TileMode tm) {
return SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm));
}
virtual ~GrRadialGradient() { }
static const char* Name() { return "Radial Gradient"; }
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendEffectFactory<GrRadialGradient>::getInstance();
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE {
+ return GrTBackendFragmentProcessorFactory<GrRadialGradient>::getInstance();
}
- typedef GrGLRadialGradient GLEffect;
+ typedef GrGLRadialGradient GLProcessor;
private:
GrRadialGradient(GrContext* ctx,
@@ -526,19 +526,19 @@
: INHERITED(ctx, shader, matrix, tm) {
}
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrGradientEffect INHERITED;
};
/////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrRadialGradient);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient);
-GrEffect* GrRadialGradient::TestCreate(SkRandom* random,
- GrContext* context,
- const GrDrawTargetCaps&,
- GrTexture**) {
+GrFragmentProcessor* GrRadialGradient::TestCreate(SkRandom* random,
+ GrContext* context,
+ const GrDrawTargetCaps&,
+ GrTexture**) {
SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius = random->nextUScalar1();
@@ -552,16 +552,16 @@
tm));
SkPaint paint;
GrColor paintColor;
- GrEffect* effect;
- SkAssertResult(shader->asNewEffect(context, paint, NULL, &paintColor, &effect));
- return effect;
+ GrFragmentProcessor* fp;
+ SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor, &fp));
+ return fp;
}
/////////////////////////////////////////////////////////////////////
void GrGLRadialGradient::emitCode(GrGLProgramBuilder* builder,
- const GrEffect&,
- const GrEffectKey& key,
+ const GrFragmentProcessor&,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -576,9 +576,9 @@
/////////////////////////////////////////////////////////////////////
-bool SkRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrix, GrColor* paintColor,
- GrEffect** effect) const {
+bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
+ const SkMatrix* localMatrix, GrColor* paintColor,
+ GrFragmentProcessor** fp) const {
SkASSERT(context);
SkMatrix matrix;
@@ -595,16 +595,15 @@
matrix.postConcat(fPtsToUnit);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
- *effect = GrRadialGradient::Create(context, *this, matrix, fTileMode);
+ *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode);
return true;
}
#else
-bool SkRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrix, GrColor* paintColor,
- GrEffect** effect) const {
+bool SkRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix*, GrColor*,
+ GrFragmentProcessor**) const {
SkDEBUGFAIL("Should not call in GPU-less build");
return false;
}