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

Unified Diff: src/effects/gradients/SkSweepGradient.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/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkSweepGradient.cpp
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 163700641c3f46f0b7310deb05ccb7b0a2d0f8bc..2493060e99e739171ca9cece8e399e9db8f10a56 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -177,15 +177,13 @@ void SkSweepGradient::SweepGradientContext::shadeSpan16(int x, int y, uint16_t*
#if SK_SUPPORT_GPU
-#include "GrTBackendProcessorFactory.h"
-#include "gl/builders/GrGLProgramBuilder.h"
#include "SkGr.h"
+#include "gl/builders/GrGLProgramBuilder.h"
class GrGLSweepGradient : public GrGLGradientEffect {
public:
- GrGLSweepGradient(const GrBackendProcessorFactory& factory,
- const GrProcessor&) : INHERITED (factory) { }
+ GrGLSweepGradient(const GrProcessor&) {}
virtual ~GrGLSweepGradient() { }
virtual void emitCode(GrGLFPBuilder*,
@@ -215,18 +213,24 @@ public:
}
virtual ~GrSweepGradient() { }
- static const char* Name() { return "Sweep Gradient"; }
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendFragmentProcessorFactory<GrSweepGradient>::getInstance();
+ virtual const char* name() const SK_OVERRIDE { return "Sweep Gradient"; }
+
+ virtual void getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const SK_OVERRIDE {
+ GrGLSweepGradient::GenKey(*this, caps, b);
}
- typedef GrGLSweepGradient GLProcessor;
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
+ return SkNEW_ARGS(GrGLSweepGradient, (*this));
+ }
private:
GrSweepGradient(GrContext* ctx,
const SkSweepGradient& shader,
const SkMatrix& matrix)
- : INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) { }
+ : INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) {
+ this->initClassID<GrSweepGradient>();
+ }
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrGradientEffect INHERITED;
@@ -264,7 +268,7 @@ void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- const GrGradientEffect& ge = fp.cast<GrGradientEffect>();
+ const GrSweepGradient& ge = fp.cast<GrSweepGradient>();
this->emitUniforms(builder, ge);
SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0);
const GrGLContextInfo ctxInfo = builder->ctxInfo();
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698