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

Unified Diff: src/effects/gradients/SkTwoPointRadialGradient.cpp

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 years, 5 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/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkTwoPointRadialGradient.cpp
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index a97cc0c38d6646e2ce3b0bd1aa53c3d53984f74a..50152744137cb1de48b013416a119711afa0b671 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -398,14 +398,14 @@ public:
virtual void emitCode(GrGLShaderBuilder*,
const GrDrawEffect&,
- EffectKey,
+ const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
- static EffectKey GenKey(const GrDrawEffect&, const GrGLCaps& caps);
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
protected:
@@ -554,13 +554,13 @@ GrGLRadial2Gradient::GrGLRadial2Gradient(const GrBackendEffectFactory& factory,
void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
const GrDrawEffect& drawEffect,
- EffectKey key,
+ const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
-
- this->emitUniforms(builder, key);
+ uint32_t baseKey = key.get32(0);
+ this->emitUniforms(builder, baseKey);
fParamUni = builder->addUniformArray(GrGLShaderBuilder::kFragment_Visibility,
kFloat_GrSLType, "Radial2FSParams", 6);
@@ -622,7 +622,7 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
t.printf("-%s / %s", cName.c_str(), bVar.c_str());
}
- this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers);
+ this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, samplers);
}
void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman,
@@ -659,17 +659,11 @@ void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman,
}
}
-GrGLEffect::EffectKey GrGLRadial2Gradient::GenKey(const GrDrawEffect& drawEffect,
- const GrGLCaps&) {
- enum {
- kIsDegenerate = 1 << kBaseKeyBitCnt,
- };
-
- EffectKey key = GenBaseGradientKey(drawEffect);
- if (drawEffect.castEffect<GrRadial2Gradient>().isDegenerate()) {
- key |= kIsDegenerate;
- }
- return key;
+void GrGLRadial2Gradient::GenKey(const GrDrawEffect& drawEffect,
+ const GrGLCaps&, GrEffectKeyBuilder* b) {
+ uint32_t* key = b->add32n(2);
+ key[0] = GenBaseGradientKey(drawEffect);
+ key[1] = drawEffect.castEffect<GrRadial2Gradient>().isDegenerate();
}
/////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698