aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrConvolutionEffect.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/GrConvolutionEffect.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/GrConvolutionEffect.cpp')
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 42dc2b49f1..4970d6270d 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -28,7 +28,6 @@ public:
virtual void initUniforms(const GrGLInterface*, int programID) SK_OVERRIDE;
virtual void setData(const GrGLInterface*,
- const GrGLTexture&,
const GrCustomStage&,
int stageNum) SK_OVERRIDE;
@@ -118,11 +117,11 @@ void GrGLConvolutionEffect::initUniforms(const GrGLInterface* gl,
}
void GrGLConvolutionEffect::setData(const GrGLInterface* gl,
- const GrGLTexture& texture,
const GrCustomStage& data,
int stageNum) {
const GrConvolutionEffect& conv =
static_cast<const GrConvolutionEffect&>(data);
+ GrTexture& texture = *data.texture(0);
// the code we generated was for a specific kernel radius
GrAssert(conv.radius() == fRadius);
float imageIncrement[2] = { 0 };
@@ -148,10 +147,11 @@ GrGLProgramStage::StageKey GrGLConvolutionEffect::GenKey(
///////////////////////////////////////////////////////////////////////////////
-GrConvolutionEffect::GrConvolutionEffect(Direction direction,
+GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
+ Direction direction,
int radius,
const float* kernel)
- : Gr1DKernelEffect(direction, radius) {
+ : Gr1DKernelEffect(texture, direction, radius) {
GrAssert(radius <= kMaxKernelRadius);
int width = this->width();
if (NULL != kernel) {
@@ -171,9 +171,10 @@ const GrProgramStageFactory& GrConvolutionEffect::getFactory() const {
bool GrConvolutionEffect::isEqual(const GrCustomStage& sBase) const {
const GrConvolutionEffect& s =
static_cast<const GrConvolutionEffect&>(sBase);
- return (this->radius() == s.radius() &&
- this->direction() == s.direction() &&
- 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float)));
+ return (INHERITED::isEqual(sBase) &&
+ this->radius() == s.radius() &&
+ this->direction() == s.direction() &&
+ 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float)));
}
void GrConvolutionEffect::setGaussianKernel(float sigma) {