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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1661143003: Next round of GrGLSLFragmentProcessor-derived class cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix overlength line Created 4 years, 11 months 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/SkBlurMaskFilter.cpp ('k') | src/effects/SkLumaColorFilter.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 e861d5836fee966ba1380539e2638ae542e629b9..e2b792245e93d94394030aee5fcd9117829c335b 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -312,20 +312,14 @@ void SkDisplacementMapEffect::toString(SkString* str) const {
#if SK_SUPPORT_GPU
class GrGLDisplacementMapEffect : public GrGLSLFragmentProcessor {
public:
- GrGLDisplacementMapEffect(const GrProcessor&);
-
void emitCode(EmitArgs&) override;
static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*);
- const GrTextureDomain::GLDomain& glDomain() const { return fGLDomain; }
-
protected:
void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
private:
- SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
- SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
GrGLSLProgramDataManager::UniformHandle fScaleUni;
GrTextureDomain::GLDomain fGLDomain;
@@ -358,11 +352,10 @@ public:
private:
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
- return new GrGLDisplacementMapEffect(*this);
+ return new GrGLDisplacementMapEffect;
}
- virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const override {
+ void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GrGLDisplacementMapEffect::GenKey(*this, caps, b);
}
@@ -542,13 +535,9 @@ const GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
///////////////////////////////////////////////////////////////////////////////
-GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrProcessor& proc)
- : fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector())
- , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector()) {
-}
-
void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
- const GrTextureDomain& domain = args.fFp.cast<GrDisplacementMapEffect>().domain();
+ const GrDisplacementMapEffect& displacementMap = args.fFp.cast<GrDisplacementMapEffect>();
+ const GrTextureDomain& domain = displacementMap.domain();
fScaleUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision, "Scale");
@@ -573,7 +562,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppendf("\t\tvec2 %s = %s + %s*(%s.",
cCoords, coords2D.c_str(), scaleUni, dColor);
- switch (fXChannelSelector) {
+ switch (displacementMap.xChannelSelector()) {
case SkDisplacementMapEffect::kR_ChannelSelectorType:
fragBuilder->codeAppend("r");
break;
@@ -591,7 +580,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
SkDEBUGFAIL("Unknown X channel selector");
}
- switch (fYChannelSelector) {
+ switch (displacementMap.yChannelSelector()) {
case SkDisplacementMapEffect::kR_ChannelSelectorType:
fragBuilder->codeAppend("r");
break;
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698