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

Unified Diff: src/effects/SkAlphaThresholdFilter.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/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkAlphaThresholdFilter.cpp
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index ffdba322649a30ebd4cec24f37e57364ca038f4c..6f9fefce1ba112af36e5c920aa3f343f2442f094 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -47,14 +47,12 @@ SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
-#include "gl/GrGLProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
-#include "GrTBackendProcessorFactory.h"
#include "GrTextureAccess.h"
#include "SkGr.h"
-class GrGLAlphaThresholdEffect;
+#include "gl/GrGLProcessor.h"
+#include "gl/builders/GrGLProgramBuilder.h"
class AlphaThresholdEffect : public GrFragmentProcessor {
@@ -71,13 +69,14 @@ public:
virtual ~AlphaThresholdEffect() {};
- static const char* Name() { return "Alpha Threshold"; }
+ virtual const char* name() const SK_OVERRIDE { return "Alpha Threshold"; }
- virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
float innerThreshold() const { return fInnerThreshold; }
float outerThreshold() const { return fOuterThreshold; }
- typedef GrGLAlphaThresholdEffect GLProcessor;
+ virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVERRIDE;
+
+ virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
private:
AlphaThresholdEffect(GrTexture* texture,
@@ -92,6 +91,7 @@ private:
, fMaskCoordTransform(kLocal_GrCoordSet,
GrCoordTransform::MakeDivByTextureWHMatrix(maskTexture), maskTexture)
, fMaskTextureAccess(maskTexture) {
+ this->initClassID<AlphaThresholdEffect>();
this->addCoordTransform(&fImageCoordTransform);
this->addTextureAccess(&fImageTextureAccess);
this->addCoordTransform(&fMaskCoordTransform);
@@ -116,7 +116,7 @@ private:
class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor {
public:
- GrGLAlphaThresholdEffect(const GrBackendProcessorFactory&, const GrProcessor&);
+ GrGLAlphaThresholdEffect(const GrFragmentProcessor&) {}
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
@@ -135,11 +135,6 @@ private:
typedef GrGLFragmentProcessor INHERITED;
};
-GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendProcessorFactory& factory,
- const GrProcessor&)
- : INHERITED(factory) {
-}
-
void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const char* outputColor,
@@ -213,8 +208,13 @@ GrFragmentProcessor* AlphaThresholdEffect::TestCreate(SkRandom* random,
///////////////////////////////////////////////////////////////////////////////
-const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() const {
- return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance();
+void AlphaThresholdEffect::getGLProcessorKey(const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const {
+ GrGLAlphaThresholdEffect::GenKey(*this, caps, b);
+}
+
+GrGLFragmentProcessor* AlphaThresholdEffect::createGLInstance() const {
+ return SkNEW_ARGS(GrGLAlphaThresholdEffect, (*this));
}
bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698