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

Unified Diff: src/gpu/effects/GrConfigConversionEffect.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 | « src/gpu/GrTextContext.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrConfigConversionEffect.cpp
===================================================================
--- src/gpu/effects/GrConfigConversionEffect.cpp (revision 8241)
+++ src/gpu/effects/GrConfigConversionEffect.cpp (working copy)
@@ -16,21 +16,22 @@
class GrGLConfigConversionEffect : public GrGLEffect {
public:
GrGLConfigConversionEffect(const GrBackendEffectFactory& factory,
- const GrEffectRef& s) : INHERITED (factory) {
- const GrConfigConversionEffect& effect = CastEffect<GrConfigConversionEffect>(s);
+ const GrDrawEffect& drawEffect)
+ : INHERITED (factory)
+ , fEffectMatrix(drawEffect.castEffect<GrConfigConversionEffect>().coordsType()) {
+ const GrConfigConversionEffect& effect = drawEffect.castEffect<GrConfigConversionEffect>();
fSwapRedAndBlue = effect.swapsRedAndBlue();
fPMConversion = effect.pmConversion();
}
virtual void emitCode(GrGLShaderBuilder* builder,
- const GrEffectStage&,
+ const GrDrawEffect&,
EffectKey key,
- const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const char* coords;
- GrSLType coordsType = fEffectMatrix.emitCode(builder, key, vertexCoords, &coords);
+ GrSLType coordsType = fEffectMatrix.emitCode(builder, key, &coords);
builder->fsCodeAppendf("\t\t%s = ", outputColor);
builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType,
samplers[0],
@@ -71,23 +72,19 @@
builder->fsCodeAppend(modulate.c_str());
}
- void setData(const GrGLUniformManager& uman, const GrEffectStage& stage) {
- const GrConfigConversionEffect& effect =
- GetEffectFromStage<GrConfigConversionEffect>(stage);
- fEffectMatrix.setData(uman,
- effect.getMatrix(),
- stage.getCoordChangeMatrix(),
- effect.texture(0));
+ void setData(const GrGLUniformManager& uman, const GrDrawEffect& drawEffect) {
+ const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigConversionEffect>();
+ fEffectMatrix.setData(uman, conv.getMatrix(), drawEffect, conv.texture(0));
}
- static inline EffectKey GenKey(const GrEffectStage& s, const GrGLCaps&) {
- const GrConfigConversionEffect& effect = GetEffectFromStage<GrConfigConversionEffect>(s);
- EffectKey key = static_cast<EffectKey>(effect.swapsRedAndBlue()) |
- (effect.pmConversion() << 1);
+ static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) {
+ const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigConversionEffect>();
+ EffectKey key = static_cast<EffectKey>(conv.swapsRedAndBlue()) | (conv.pmConversion() << 1);
key <<= GrGLEffectMatrix::kKeyBits;
- EffectKey matrixKey = GrGLEffectMatrix::GenKey(effect.getMatrix(),
- s.getCoordChangeMatrix(),
- effect.texture(0));
+ EffectKey matrixKey = GrGLEffectMatrix::GenKey(conv.getMatrix(),
+ drawEffect,
+ conv.coordsType(),
+ conv.texture(0));
GrAssert(!(matrixKey & key));
return matrixKey | key;
}
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698