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

Unified Diff: src/effects/SkBicubicImageFilter.cpp

Issue 12531015: Adds local coords to GrEffect system. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « include/gpu/GrTBackendEffectFactory.h ('k') | src/effects/SkBlendImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBicubicImageFilter.cpp
===================================================================
--- src/effects/SkBicubicImageFilter.cpp (revision 8241)
+++ src/effects/SkBicubicImageFilter.cpp (working copy)
@@ -185,18 +185,17 @@
class GrGLBicubicEffect : public GrGLEffect {
public:
GrGLBicubicEffect(const GrBackendEffectFactory& factory,
- const GrEffectRef& effect);
+ const GrDrawEffect&);
virtual void emitCode(GrGLShaderBuilder*,
- const GrEffectStage&,
+ const GrDrawEffect&,
EffectKey,
- const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline EffectKey GenKey(const GrEffectStage&, const GrGLCaps&);
+ static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
- virtual void setData(const GrGLUniformManager&, const GrEffectStage&) SK_OVERRIDE;
+ virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
private:
typedef GrGLUniformManager::UniformHandle UniformHandle;
@@ -210,21 +209,21 @@
};
GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendEffectFactory& factory,
- const GrEffectRef& effect)
+ const GrDrawEffect& drawEffect)
: INHERITED(factory)
, fCoefficientsUni(GrGLUniformManager::kInvalidUniformHandle)
- , fImageIncrementUni(GrGLUniformManager::kInvalidUniformHandle) {
+ , fImageIncrementUni(GrGLUniformManager::kInvalidUniformHandle)
+ , fEffectMatrix(drawEffect.castEffect<GrBicubicEffect>().coordsType()) {
}
void GrGLBicubicEffect::emitCode(GrGLShaderBuilder* builder,
- const GrEffectStage&,
+ const GrDrawEffect&,
EffectKey key,
- const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) {
const char* coords;
- fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, vertexCoords, &coords);
+ fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, &coords);
fCoefficientsUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
kMat44f_GrSLType, "Coefficients");
fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
@@ -269,17 +268,18 @@
builder->fsCodeAppendf("\t%s = %s(%s, f.y, s0, s1, s2, s3);\n", outputColor, cubicBlendName.c_str(), coeff);
}
-GrGLEffect::EffectKey GrGLBicubicEffect::GenKey(const GrEffectStage& s, const GrGLCaps&) {
- const GrBicubicEffect& m = GetEffectFromStage<GrBicubicEffect>(s);
- EffectKey matrixKey = GrGLEffectMatrix::GenKey(m.getMatrix(),
- s.getCoordChangeMatrix(),
- m.texture(0));
+GrGLEffect::EffectKey GrGLBicubicEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) {
+ const GrBicubicEffect& bicubic = drawEffect.castEffect<GrBicubicEffect>();
+ EffectKey matrixKey = GrGLEffectMatrix::GenKey(bicubic.getMatrix(),
+ drawEffect,
+ bicubic.coordsType(),
+ bicubic.texture(0));
return matrixKey;
}
void GrGLBicubicEffect::setData(const GrGLUniformManager& uman,
- const GrEffectStage& stage) {
- const GrBicubicEffect& effect = GetEffectFromStage<GrBicubicEffect>(stage);
+ const GrDrawEffect& drawEffect) {
+ const GrBicubicEffect& effect = drawEffect.castEffect<GrBicubicEffect>();
GrTexture& texture = *effect.texture(0);
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture.width();
@@ -288,7 +288,7 @@
uman.setMatrix4f(fCoefficientsUni, effect.coefficients());
fEffectMatrix.setData(uman,
effect.getMatrix(),
- stage.getCoordChangeMatrix(),
+ drawEffect,
effect.texture(0));
}
« no previous file with comments | « include/gpu/GrTBackendEffectFactory.h ('k') | src/effects/SkBlendImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698