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

Unified Diff: src/effects/SkDisplacementMapEffect.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/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index d39240e012bdd8ee84d31f72885e543f75e91907..04919ee737cbdbddfb4cf04c5976a1aa72209ac1 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -16,7 +16,6 @@
#include "GrInvariantOutput.h"
#include "gl/GrGLProcessor.h"
#include "gl/builders/GrGLProgramBuilder.h"
-#include "GrTBackendProcessorFactory.h"
#endif
namespace {
@@ -287,8 +286,7 @@ bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
#if SK_SUPPORT_GPU
class GrGLDisplacementMapEffect : public GrGLFragmentProcessor {
public:
- GrGLDisplacementMapEffect(const GrBackendProcessorFactory&,
- const GrProcessor&);
+ GrGLDisplacementMapEffect(const GrProcessor&);
virtual ~GrGLDisplacementMapEffect();
virtual void emitCode(GrGLFPBuilder*,
@@ -328,15 +326,22 @@ public:
virtual ~GrDisplacementMapEffect();
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
+ virtual void getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const SK_OVERRIDE {
+ GrGLDisplacementMapEffect::GenKey(*this, caps, b);
+ }
+
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
+ return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this));
+ }
+
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const
{ return fXChannelSelector; }
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const
{ return fYChannelSelector; }
const SkVector& scale() const { return fScale; }
- typedef GrGLDisplacementMapEffect GLProcessor;
- static const char* Name() { return "DisplacementMap"; }
+ virtual const char* name() const SK_OVERRIDE { return "DisplacementMap"; }
private:
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
@@ -456,6 +461,7 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
, fXChannelSelector(xChannelSelector)
, fYChannelSelector(yChannelSelector)
, fScale(scale) {
+ this->initClassID<GrDisplacementMapEffect>();
this->addCoordTransform(&fDisplacementTransform);
this->addTextureAccess(&fDisplacementAccess);
this->addCoordTransform(&fColorTransform);
@@ -472,10 +478,6 @@ bool GrDisplacementMapEffect::onIsEqual(const GrFragmentProcessor& sBase) const
fScale == s.fScale;
}
-const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() const {
- return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInstance();
-}
-
void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
// Any displacement offset bringing a pixel out of bounds will output a color of (0,0,0,0),
// so the only way we'd get a constant alpha is if the input color image has a constant alpha
@@ -514,10 +516,8 @@ GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random,
///////////////////////////////////////////////////////////////////////////////
-GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor& proc)
- : INHERITED(factory)
- , fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector())
+GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrProcessor& proc)
+ : fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector())
, fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector()) {
}
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698