Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: src/effects/gradients/SkRadialGradient.cpp

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkRadialGradient.cpp
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 7c0e8f603174bd87f02746ebc3f28450bc067e59..e880df25cbbe59aa8d665467a26a995624b601b4 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -461,15 +461,13 @@ void SkRadialGradient::RadialGradientContext::shadeSpan(int x, int y,
#if SK_SUPPORT_GPU
-#include "GrTBackendProcessorFactory.h"
-#include "gl/builders/GrGLProgramBuilder.h"
#include "SkGr.h"
+#include "gl/builders/GrGLProgramBuilder.h"
class GrGLRadialGradient : public GrGLGradientEffect {
public:
- GrGLRadialGradient(const GrBackendProcessorFactory& factory,
- const GrProcessor&) : INHERITED (factory) { }
+ GrGLRadialGradient(const GrProcessor&) {}
virtual ~GrGLRadialGradient() { }
virtual void emitCode(GrGLFPBuilder*,
@@ -502,12 +500,16 @@ public:
virtual ~GrRadialGradient() { }
- static const char* Name() { return "Radial Gradient"; }
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendFragmentProcessorFactory<GrRadialGradient>::getInstance();
+ virtual const char* name() const SK_OVERRIDE { return "Radial Gradient"; }
+
+ virtual void getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const SK_OVERRIDE {
+ GrGLRadialGradient::GenKey(*this, caps, b);
}
- typedef GrGLRadialGradient GLProcessor;
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
+ return SkNEW_ARGS(GrGLRadialGradient, (*this));
+ }
private:
GrRadialGradient(GrContext* ctx,
@@ -515,6 +517,7 @@ private:
const SkMatrix& matrix,
SkShader::TileMode tm)
: INHERITED(ctx, shader, matrix, tm) {
+ this->initClassID<GrRadialGradient>();
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -556,7 +559,7 @@ void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- const GrGradientEffect& ge = fp.cast<GrGradientEffect>();
+ const GrRadialGradient& ge = fp.cast<GrRadialGradient>();
this->emitUniforms(builder, ge);
SkString t("length(");
t.append(builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0));
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698