aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrMorphologyEffect.cpp
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-12 17:23:52 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-12 17:23:52 +0000
commitd0c1a06cb98dd4a009dfa79e37ba6ca23a8c180b (patch)
tree8da05f518d09f633dfd00f94b45593182089deac /src/gpu/effects/GrMorphologyEffect.cpp
parentd7727ceb82e271f8b5580c51571c57b09c5e3ced (diff)
Introduces new SingleTextureEffect base class for GrCustomStage objects.
This class tracks the texture that the object uses. A future commit will get rid of the GrTexture pointer currenty stored in the GrDrawState, allowing us to have CustomStages *without* textures. Requires gyp change on next roll. http://codereview.appspot.com/6306097/ git-svn-id: http://skia.googlecode.com/svn/trunk@4576 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrMorphologyEffect.cpp')
-rw-r--r--src/gpu/effects/GrMorphologyEffect.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gpu/effects/GrMorphologyEffect.cpp b/src/gpu/effects/GrMorphologyEffect.cpp
index 43e870285f..3ea2cbd125 100644
--- a/src/gpu/effects/GrMorphologyEffect.cpp
+++ b/src/gpu/effects/GrMorphologyEffect.cpp
@@ -31,7 +31,6 @@ public:
virtual void initUniforms(const GrGLInterface*, int programID) SK_OVERRIDE;
virtual void setData(const GrGLInterface*,
- const GrGLTexture&,
const GrCustomStage&,
int stageNum) SK_OVERRIDE;
@@ -124,11 +123,12 @@ GrGLProgramStage::StageKey GrGLMorphologyEffect::GenKey(
}
void GrGLMorphologyEffect ::setData(const GrGLInterface* gl,
- const GrGLTexture& texture,
const GrCustomStage& data,
int stageNum) {
const Gr1DKernelEffect& kern =
static_cast<const Gr1DKernelEffect&>(data);
+ GrGLTexture& texture =
+ *static_cast<GrGLTexture*>(data.texture(0));
// the code we generated was for a specific kernel radius
GrAssert(kern.radius() == fRadius);
float imageIncrement[2] = { 0 };
@@ -147,10 +147,11 @@ void GrGLMorphologyEffect ::setData(const GrGLInterface* gl,
///////////////////////////////////////////////////////////////////////////////
-GrMorphologyEffect::GrMorphologyEffect(Direction direction,
+GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture,
+ Direction direction,
int radius,
MorphologyType type)
- : Gr1DKernelEffect(direction, radius)
+ : Gr1DKernelEffect(texture, direction, radius)
, fType(type) {
}
@@ -164,7 +165,8 @@ const GrProgramStageFactory& GrMorphologyEffect::getFactory() const {
bool GrMorphologyEffect::isEqual(const GrCustomStage& sBase) const {
const GrMorphologyEffect& s =
static_cast<const GrMorphologyEffect&>(sBase);
- return (this->radius() == s.radius() &&
+ return (INHERITED::isEqual(sBase) &&
+ this->radius() == s.radius() &&
this->direction() == s.direction() &&
this->type() == s.type());
}