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

Unified Diff: src/effects/gradients/SkTwoPointConicalGradient.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/effects/gradients/SkSweepGradient.cpp ('k') | src/effects/gradients/SkTwoPointRadialGradient.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkTwoPointConicalGradient.cpp
===================================================================
--- src/effects/gradients/SkTwoPointConicalGradient.cpp (revision 8241)
+++ src/effects/gradients/SkTwoPointConicalGradient.cpp (working copy)
@@ -336,20 +336,18 @@
class GrGLConical2Gradient : public GrGLGradientEffect {
public:
- GrGLConical2Gradient(const GrBackendEffectFactory& factory,
- const GrEffectRef&);
+ GrGLConical2Gradient(const GrBackendEffectFactory& factory, const GrDrawEffect&);
virtual ~GrGLConical2Gradient() { }
virtual void emitCode(GrGLShaderBuilder*,
- const GrEffectStage&,
+ const GrDrawEffect&,
EffectKey,
- const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrEffectStage&) SK_OVERRIDE;
+ virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
- static EffectKey GenKey(const GrEffectStage&, const GrGLCaps& caps);
+ static EffectKey GenKey(const GrDrawEffect&, const GrGLCaps& caps);
protected:
@@ -469,7 +467,7 @@
/////////////////////////////////////////////////////////////////////
GrGLConical2Gradient::GrGLConical2Gradient(const GrBackendEffectFactory& factory,
- const GrEffectRef& baseData)
+ const GrDrawEffect& drawEffect)
: INHERITED(factory)
, fVSParamUni(kInvalidUniformHandle)
, fFSParamUni(kInvalidUniformHandle)
@@ -479,21 +477,20 @@
, fCachedRadius(-SK_ScalarMax)
, fCachedDiffRadius(-SK_ScalarMax) {
- const GrConical2Gradient& data = CastEffect<GrConical2Gradient>(baseData);
+ const GrConical2Gradient& data = drawEffect.castEffect<GrConical2Gradient>();
fIsDegenerate = data.isDegenerate();
}
void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder,
- const GrEffectStage&,
+ const GrDrawEffect&,
EffectKey key,
- const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) {
const char* fsCoords;
const char* vsCoordsVarying;
GrSLType coordsVaryingType;
- this->setupMatrix(builder, key, vertexCoords, &fsCoords, &vsCoordsVarying, &coordsVaryingType);
+ this->setupMatrix(builder, key, &fsCoords, &vsCoordsVarying, &coordsVaryingType);
this->emitYCoordUniform(builder);
// 2 copies of uniform array, 1 for each of vertex & fragment shader,
@@ -651,9 +648,10 @@
}
}
-void GrGLConical2Gradient::setData(const GrGLUniformManager& uman, const GrEffectStage& stage) {
- INHERITED::setData(uman, stage);
- const GrConical2Gradient& data = GetEffectFromStage<GrConical2Gradient>(stage);
+void GrGLConical2Gradient::setData(const GrGLUniformManager& uman,
+ const GrDrawEffect& drawEffect) {
+ INHERITED::setData(uman, drawEffect);
+ const GrConical2Gradient& data = drawEffect.castEffect<GrConical2Gradient>();
GrAssert(data.isDegenerate() == fIsDegenerate);
SkScalar centerX1 = data.center();
SkScalar radius0 = data.radius();
@@ -687,13 +685,14 @@
}
}
-GrGLEffect::EffectKey GrGLConical2Gradient::GenKey(const GrEffectStage& s, const GrGLCaps&) {
+GrGLEffect::EffectKey GrGLConical2Gradient::GenKey(const GrDrawEffect& drawEffect,
+ const GrGLCaps&) {
enum {
kIsDegenerate = 1 << kMatrixKeyBitCnt,
};
- EffectKey key = GenMatrixKey(s);
- if (GetEffectFromStage<GrConical2Gradient>(s).isDegenerate()) {
+ EffectKey key = GenMatrixKey(drawEffect);
+ if (drawEffect.castEffect<GrConical2Gradient>().isDegenerate()) {
key |= kIsDegenerate;
}
return key;
« no previous file with comments | « src/effects/gradients/SkSweepGradient.cpp ('k') | src/effects/gradients/SkTwoPointRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698