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

Unified Diff: src/gpu/effects/GrRRectEffect.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/gpu/effects/GrRRectEffect.h ('k') | src/gpu/effects/GrSimpleTextureEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrRRectEffect.cpp
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 7e58c1fe287a58b95e6c7084d2e18959687758a3..4c8e88636e050b7a5ced024889f9ae4522763246 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -5,25 +5,22 @@
* found in the LICENSE file.
*/
-#include "gl/builders/GrGLProgramBuilder.h"
#include "GrRRectEffect.h"
-#include "gl/GrGLProcessor.h"
-#include "gl/GrGLSL.h"
#include "GrConvexPolyEffect.h"
+#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOvalEffect.h"
-#include "GrTBackendProcessorFactory.h"
-
#include "SkRRect.h"
+#include "gl/GrGLProcessor.h"
+#include "gl/GrGLSL.h"
+#include "gl/builders/GrGLProgramBuilder.h"
// The effects defined here only handle rrect radii >= kRadiusMin.
static const SkScalar kRadiusMin = SK_ScalarHalf;
//////////////////////////////////////////////////////////////////////////////
-class GLCircularRRectEffect;
-
class CircularRRectEffect : public GrFragmentProcessor {
public:
@@ -50,7 +47,12 @@ public:
const SkRRect&);
virtual ~CircularRRectEffect() {};
- static const char* Name() { return "CircularRRect"; }
+
+ virtual const char* name() const SK_OVERRIDE { return "CircularRRect"; }
+
+ virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVERRIDE;
+
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
const SkRRect& getRRect() const { return fRRect; }
@@ -58,10 +60,6 @@ public:
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GLCircularRRectEffect GLProcessor;
-
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
-
private:
CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const SkRRect&);
@@ -91,15 +89,12 @@ void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con
inout->mulByUnknownAlpha();
}
-const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const {
- return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance();
-}
-
CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t circularCornerFlags,
const SkRRect& rrect)
: fRRect(rrect)
, fEdgeType(edgeType)
, fCircularCornerFlags(circularCornerFlags) {
+ this->initClassID<CircularRRectEffect>();
this->setWillReadFragmentPosition();
}
@@ -135,7 +130,7 @@ GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random,
class GLCircularRRectEffect : public GrGLFragmentProcessor {
public:
- GLCircularRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GLCircularRRectEffect(const GrProcessor&);
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
@@ -155,9 +150,7 @@ private:
typedef GrGLFragmentProcessor INHERITED;
};
-GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& )
- : INHERITED (factory) {
+GLCircularRRectEffect::GLCircularRRectEffect(const GrProcessor& ) {
fPrevRRect.setEmpty();
}
@@ -380,25 +373,34 @@ void GLCircularRRectEffect::setData(const GrGLProgramDataManager& pdman,
}
}
-//////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
-class GLEllipticalRRectEffect;
+void CircularRRectEffect::getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const {
+ GLCircularRRectEffect::GenKey(*this, caps, b);
+}
+
+GrGLFragmentProcessor* CircularRRectEffect::createGLInstance() const {
+ return SkNEW_ARGS(GLCircularRRectEffect, (*this));
+}
+
+//////////////////////////////////////////////////////////////////////////////
class EllipticalRRectEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&);
virtual ~EllipticalRRectEffect() {};
- static const char* Name() { return "EllipticalRRect"; }
- const SkRRect& getRRect() const { return fRRect; }
+ virtual const char* name() const SK_OVERRIDE { return "EllipticalRRect"; }
+ virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVERRIDE;
- GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
- typedef GLEllipticalRRectEffect GLProcessor;
+ const SkRRect& getRRect() const { return fRRect; }
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
private:
EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&);
@@ -427,13 +429,10 @@ void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
inout->mulByUnknownAlpha();
}
-const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() const {
- return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstance();
-}
-
EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
: fRRect(rrect)
- , fEdgeType(edgeType){
+ , fEdgeType(edgeType) {
+ this->initClassID<EllipticalRRectEffect>();
this->setWillReadFragmentPosition();
}
@@ -488,7 +487,7 @@ GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random,
class GLEllipticalRRectEffect : public GrGLFragmentProcessor {
public:
- GLEllipticalRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GLEllipticalRRectEffect(const GrProcessor&);
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& effect,
@@ -508,9 +507,7 @@ private:
typedef GrGLFragmentProcessor INHERITED;
};
-GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& effect)
- : INHERITED (factory) {
+GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrProcessor& effect) {
fPrevRRect.setEmpty();
}
@@ -634,6 +631,17 @@ void GLEllipticalRRectEffect::setData(const GrGLProgramDataManager& pdman,
}
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void EllipticalRRectEffect::getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const {
+ GLEllipticalRRectEffect::GenKey(*this, caps, b);
+}
+
+GrGLFragmentProcessor* EllipticalRRectEffect::createGLInstance() const {
+ return SkNEW_ARGS(GLEllipticalRRectEffect, (*this));
+}
+
//////////////////////////////////////////////////////////////////////////////
GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
« no previous file with comments | « src/gpu/effects/GrRRectEffect.h ('k') | src/gpu/effects/GrSimpleTextureEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698