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

Unified Diff: src/effects/gradients/SkGradientShader.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/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
===================================================================
--- src/effects/gradients/SkGradientShader.cpp (revision 8241)
+++ src/effects/gradients/SkGradientShader.cpp (working copy)
@@ -734,12 +734,14 @@
#if SK_SUPPORT_GPU
#include "effects/GrTextureStripAtlas.h"
+#include "GrTBackendEffectFactory.h"
#include "SkGr.h"
GrGLGradientEffect::GrGLGradientEffect(const GrBackendEffectFactory& factory)
: INHERITED(factory)
, fCachedYCoord(SK_ScalarMax)
- , fFSYUni(GrGLUniformManager::kInvalidUniformHandle) {
+ , fFSYUni(GrGLUniformManager::kInvalidUniformHandle)
+ , fEffectMatrix(kCoordsType) {
}
GrGLGradientEffect::~GrGLGradientEffect() { }
@@ -749,10 +751,11 @@
kFloat_GrSLType, "GradientYCoordFS");
}
-void GrGLGradientEffect::setData(const GrGLUniformManager& uman, const GrEffectStage& stage) {
- const GrGradientEffect& e = GetEffectFromStage<GrGradientEffect>(stage);
+void GrGLGradientEffect::setData(const GrGLUniformManager& uman,
+ const GrDrawEffect& drawEffect) {
+ const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>();
const GrTexture* texture = e.texture(0);
- fEffectMatrix.setData(uman, e.getMatrix(), stage.getCoordChangeMatrix(), texture);
+ fEffectMatrix.setData(uman, e.getMatrix(), drawEffect, texture);
SkScalar yCoord = e.getYCoord();
if (yCoord != fCachedYCoord) {
@@ -761,21 +764,19 @@
}
}
-GrGLEffect::EffectKey GrGLGradientEffect::GenMatrixKey(const GrEffectStage& s) {
- const GrGradientEffect& e = GetEffectFromStage<GrGradientEffect>(s);
+GrGLEffect::EffectKey GrGLGradientEffect::GenMatrixKey(const GrDrawEffect& drawEffect) {
+ const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>();
const GrTexture* texture = e.texture(0);
- return GrGLEffectMatrix::GenKey(e.getMatrix(), s.getCoordChangeMatrix(), texture);
+ return GrGLEffectMatrix::GenKey(e.getMatrix(), drawEffect, kCoordsType, texture);
}
void GrGLGradientEffect::setupMatrix(GrGLShaderBuilder* builder,
EffectKey key,
- const char* vertexCoords,
const char** fsCoordName,
const char** vsVaryingName,
GrSLType* vsVaryingType) {
fEffectMatrix.emitCodeMakeFSCoords2D(builder,
key & kMatrixKeyMask,
- vertexCoords,
fsCoordName,
vsVaryingName,
vsVaryingType);
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698