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

Unified Diff: src/gpu/effects/GrDistanceFieldGeoProc.cpp

Issue 1512533003: Remove uniform color for GrDistanceFieldGeoProc (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext4
Patch Set: mac warnings Created 5 years 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/effects/GrDistanceFieldGeoProc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDistanceFieldGeoProc.cpp
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index f6c41cbf1924621a0718a02e1d1ebe5ceade3e7e..7a63a62dec62a973bd44d38664b82732880361ff 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -26,7 +26,6 @@ class GrGLDistanceFieldA8TextGeoProc : public GrGLSLGeometryProcessor {
public:
GrGLDistanceFieldA8TextGeoProc()
: fViewMatrix(SkMatrix::InvalidMatrix())
- , fColor(GrColor_ILLEGAL)
#ifdef SK_GAMMA_APPLY_TO_A8
, fDistanceAdjust(-1.0f)
#endif
@@ -57,12 +56,7 @@ public:
// Setup pass through color
if (!dfTexEffect.colorIgnored()) {
- if (dfTexEffect.hasVertexColor()) {
- varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
- } else {
- this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
- &fColorUniform);
- }
+ varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
}
// Setup position
@@ -174,13 +168,6 @@ public:
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
-
- if (dfa8gp.color() != fColor && !dfa8gp.hasVertexColor()) {
- float c[4];
- GrColorToRGBAFloat(dfa8gp.color(), c);
- pdman.set4fv(fColorUniform, 1, c);
- fColor = dfa8gp.color();
- }
}
static inline void GenKey(const GrGeometryProcessor& gp,
@@ -188,8 +175,7 @@ public:
GrProcessorKeyBuilder* b) {
const GrDistanceFieldA8TextGeoProc& dfTexEffect = gp.cast<GrDistanceFieldA8TextGeoProc>();
uint32_t key = dfTexEffect.getFlags();
- key |= dfTexEffect.hasVertexColor() << 16;
- key |= dfTexEffect.colorIgnored() << 17;
+ key |= dfTexEffect.colorIgnored() << 16;
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
b->add32(key);
@@ -203,8 +189,6 @@ public:
private:
SkMatrix fViewMatrix;
- GrColor fColor;
- UniformHandle fColorUniform;
UniformHandle fViewMatrixUniform;
#ifdef SK_GAMMA_APPLY_TO_A8
float fDistanceAdjust;
@@ -238,9 +222,7 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
this->initClassID<GrDistanceFieldA8TextGeoProc>();
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
kHigh_GrSLPrecision));
- if (flags & kColorAttr_DistanceFieldEffectFlag) {
- fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
- }
+ fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
kVec2s_GrVertexAttribType));
this->addTextureAccess(&fTextureAccess);
@@ -291,7 +273,6 @@ class GrGLDistanceFieldPathGeoProc : public GrGLSLGeometryProcessor {
public:
GrGLDistanceFieldPathGeoProc()
: fViewMatrix(SkMatrix::InvalidMatrix())
- , fColor(GrColor_ILLEGAL)
, fTextureSize(SkISize::Make(-1, -1)) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
@@ -313,12 +294,7 @@ public:
// setup pass through color
if (!dfTexEffect.colorIgnored()) {
- if (dfTexEffect.hasVertexColor()) {
- varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
- } else {
- this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
- &fColorUniform);
- }
+ varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
}
vertBuilder->codeAppendf("%s = %s;", v.vsOut(), dfTexEffect.inTextureCoords()->fName);
@@ -415,13 +391,6 @@ public:
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
-
- if (dfpgp.color() != fColor && !dfpgp.hasVertexColor()) {
- float c[4];
- GrColorToRGBAFloat(dfpgp.color(), c);
- pdman.set4fv(fColorUniform, 1, c);
- fColor = dfpgp.color();
- }
}
static inline void GenKey(const GrGeometryProcessor& gp,
@@ -431,17 +400,14 @@ public:
uint32_t key = dfTexEffect.getFlags();
key |= dfTexEffect.colorIgnored() << 16;
- key |= dfTexEffect.hasVertexColor() << 17;
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
b->add32(key);
}
private:
- UniformHandle fColorUniform;
UniformHandle fTextureSizeUni;
UniformHandle fViewMatrixUniform;
SkMatrix fViewMatrix;
- GrColor fColor;
SkISize fTextureSize;
typedef GrGLSLGeometryProcessor INHERITED;
@@ -466,9 +432,7 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
this->initClassID<GrDistanceFieldPathGeoProc>();
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
kHigh_GrSLPrecision));
- if (flags & kColorAttr_DistanceFieldEffectFlag) {
- fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
- }
+ fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
kVec2f_GrVertexAttribType));
this->addTextureAccess(&fTextureAccess);
@@ -516,7 +480,7 @@ const GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes
class GrGLDistanceFieldLCDTextGeoProc : public GrGLSLGeometryProcessor {
public:
GrGLDistanceFieldLCDTextGeoProc()
- : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
+ : fViewMatrix(SkMatrix::InvalidMatrix()) {
fDistanceAdjust = GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(1.0f, 1.0f, 1.0f);
}
@@ -535,12 +499,7 @@ public:
// setup pass through color
if (!dfTexEffect.colorIgnored()) {
- if (dfTexEffect.hasVertexColor()) {
- varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
- } else {
- this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
- &fColorUniform);
- }
+ varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args.fOutputColor);
}
// Setup position
@@ -700,13 +659,6 @@ public:
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
-
- if (dflcd.color() != fColor && !dflcd.hasVertexColor()) {
- float c[4];
- GrColorToRGBAFloat(dflcd.color(), c);
- pdman.set4fv(fColorUniform, 1, c);
- fColor = dflcd.color();
- }
}
static inline void GenKey(const GrGeometryProcessor& gp,
@@ -729,7 +681,6 @@ public:
private:
SkMatrix fViewMatrix;
- GrColor fColor;
UniformHandle fViewMatrixUniform;
UniformHandle fColorUniform;
GrDistanceFieldLCDTextGeoProc::DistanceAdjust fDistanceAdjust;
@@ -755,9 +706,7 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
this->initClassID<GrDistanceFieldLCDTextGeoProc>();
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
kHigh_GrSLPrecision));
- if (flags & kColorAttr_DistanceFieldEffectFlag) {
- fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
- }
+ fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
kVec2s_GrVertexAttribType));
this->addTextureAccess(&fTextureAccess);
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698