This cl moves color and coverage off of drawstate. In an effort to keep this CL manageable, I have left the compute invariant input / output in a bit of a strange state(fixing this will be complicated).
In addition, NVPR makes this very complicated, and I haven't quite figured out a good way to handle it, so for now color and coverage DO live on optstate, but I will figure out some way to refactor that in future CLs.
BUG=skia:
Review URL: https://codereview.chromium.org/783763002
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 5abd293..6ad1537 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -139,8 +139,8 @@
return SkNEW_ARGS(GrGLConicEffect, (*this, bt));
}
-GrConicEffect::GrConicEffect(GrPrimitiveEdgeType edgeType)
- : fEdgeType(edgeType) {
+GrConicEffect::GrConicEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeType edgeType)
+ : INHERITED(color, coverage), fEdgeType(edgeType) {
this->initClassID<GrConicEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs",
@@ -164,7 +164,7 @@
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
random->nextULessThan(kGrProcessorEdgeTypeCnt));
- gp = GrConicEffect::Create(edgeType, caps);
+ gp = GrConicEffect::Create(GrRandomColor(random), edgeType, caps);
} while (NULL == gp);
return gp;
}
@@ -286,8 +286,8 @@
return SkNEW_ARGS(GrGLQuadEffect, (*this, bt));
}
-GrQuadEffect::GrQuadEffect(GrPrimitiveEdgeType edgeType)
- : fEdgeType(edgeType) {
+GrQuadEffect::GrQuadEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeType edgeType)
+ : INHERITED(color, coverage), fEdgeType(edgeType) {
this->initClassID<GrQuadEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge",
@@ -311,7 +311,7 @@
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
random->nextULessThan(kGrProcessorEdgeTypeCnt));
- gp = GrQuadEffect::Create(edgeType, caps);
+ gp = GrQuadEffect::Create(GrRandomColor(random), edgeType, caps);
} while (NULL == gp);
return gp;
}
@@ -474,8 +474,8 @@
return SkNEW_ARGS(GrGLCubicEffect, (*this, bt));
}
-GrCubicEffect::GrCubicEffect(GrPrimitiveEdgeType edgeType)
- : fEdgeType(edgeType) {
+GrCubicEffect::GrCubicEffect(GrColor color, GrPrimitiveEdgeType edgeType)
+ : INHERITED(color), fEdgeType(edgeType) {
this->initClassID<GrCubicEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInCubicCoeffs = &this->addVertexAttrib(GrAttribute("inCubicCoeffs",
@@ -499,7 +499,7 @@
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
random->nextULessThan(kGrProcessorEdgeTypeCnt));
- gp = GrCubicEffect::Create(edgeType, caps);
+ gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps);
} while (NULL == gp);
return gp;
}
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index dfab3a9..a9cbeb0 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -58,21 +58,24 @@
class GrConicEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
- const GrDrawTargetCaps& caps) {
+ static GrGeometryProcessor* Create(GrColor color,
+ const GrPrimitiveEdgeType edgeType,
+ const GrDrawTargetCaps& caps,
+ uint8_t coverage = 0xff) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrConicEffect, (kFillAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrConicEffect, (color, coverage, kFillAA_GrProcessorEdgeType));
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrConicEffect, (kHairlineAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrConicEffect, (color, coverage,
+ kHairlineAA_GrProcessorEdgeType));
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrConicEffect, (kFillBW_GrProcessorEdgeType));;
+ return SkNEW_ARGS(GrConicEffect, (color, coverage, kFillBW_GrProcessorEdgeType));;
default:
return NULL;
}
@@ -95,7 +98,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrConicEffect(GrPrimitiveEdgeType);
+ GrConicEffect(GrColor, uint8_t coverage, GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
@@ -125,21 +128,23 @@
class GrQuadEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
- const GrDrawTargetCaps& caps) {
+ static GrGeometryProcessor* Create(GrColor color,
+ const GrPrimitiveEdgeType edgeType,
+ const GrDrawTargetCaps& caps,
+ uint8_t coverage = 0xff) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrQuadEffect, (kFillAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrQuadEffect, (color, coverage, kFillAA_GrProcessorEdgeType));
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrQuadEffect, (kHairlineAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrQuadEffect, (color, coverage, kHairlineAA_GrProcessorEdgeType));
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrQuadEffect, (kFillBW_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrQuadEffect, (color, coverage, kFillBW_GrProcessorEdgeType));
default:
return NULL;
}
@@ -162,7 +167,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrQuadEffect(GrPrimitiveEdgeType);
+ GrQuadEffect(GrColor, uint8_t coverage, GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
@@ -194,21 +199,22 @@
class GrCubicEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
+ static GrGeometryProcessor* Create(GrColor color,
+ const GrPrimitiveEdgeType edgeType,
const GrDrawTargetCaps& caps) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrCubicEffect, (kFillAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrCubicEffect, (color, kFillAA_GrProcessorEdgeType));
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
- return SkNEW_ARGS(GrCubicEffect, (kHairlineAA_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrCubicEffect, (color, kHairlineAA_GrProcessorEdgeType));
case kFillBW_GrProcessorEdgeType:
- return SkNEW_ARGS(GrCubicEffect, (kFillBW_GrProcessorEdgeType));
+ return SkNEW_ARGS(GrCubicEffect, (color, kFillBW_GrProcessorEdgeType));
default:
return NULL;
}
@@ -231,7 +237,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrCubicEffect(GrPrimitiveEdgeType);
+ GrCubicEffect(GrColor, GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 6eaaf30..1578fd8 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -65,9 +65,9 @@
///////////////////////////////////////////////////////////////////////////////
-GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrTexture* texture, const GrTextureParams& params,
- bool useColorAttrib)
- : fTextureAccess(texture, params), fInColor(NULL) {
+GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
+ const GrTextureParams& params, bool useColorAttrib)
+ : INHERITED(color), fTextureAccess(texture, params), fInColor(NULL) {
this->initClassID<GrBitmapTextGeoProc>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
if (useColorAttrib) {
@@ -128,5 +128,6 @@
GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode :
GrTextureParams::kNone_FilterMode);
- return GrBitmapTextGeoProc::Create(textures[texIdx], params, random->nextBool());
+ return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params,
+ random->nextBool());
}
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h
index ecbf4f9..ce235ae 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.h
+++ b/src/gpu/effects/GrBitmapTextGeoProc.h
@@ -21,9 +21,9 @@
*/
class GrBitmapTextGeoProc : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p,
+ static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& p,
bool useColorAttrib) {
- return SkNEW_ARGS(GrBitmapTextGeoProc, (tex, p, useColorAttrib));
+ return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, useColorAttrib));
}
virtual ~GrBitmapTextGeoProc() {}
@@ -41,7 +41,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrBitmapTextGeoProc(GrTexture* texture, const GrTextureParams& params, bool useColorAttrib);
+ GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params, bool useColorAttrib);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 53485f6..b59b2a6 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -165,7 +165,7 @@
}
bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState* drawState,
- const SkPoint pts[2], const GrPaint& paint,
+ GrColor color, const SkPoint pts[2], const GrPaint& paint,
const GrStrokeInfo& strokeInfo, const SkMatrix& vm) {
if (!can_fast_path_dash(pts, strokeInfo, *target, *drawState, vm)) {
@@ -347,10 +347,10 @@
bool isRoundCap = SkPaint::kRound_Cap == cap;
GrDashingEffect::DashCap capType = isRoundCap ? GrDashingEffect::kRound_DashCap :
GrDashingEffect::kNonRound_DashCap;
- gp = GrDashingEffect::Create(edgeType, devInfo, strokeWidth, capType);
+ gp = GrDashingEffect::Create(color, edgeType, devInfo, strokeWidth, capType);
} else {
// Set up the vertex data for the line and start/end dashes
- gp = GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType);
+ gp = GrDefaultGeoProcFactory::Create(color, GrDefaultGeoProcFactory::kPosition_GPType);
}
drawState->setGeometryProcessor(gp)->unref();
@@ -456,7 +456,8 @@
public:
typedef SkPathEffect::DashInfo DashInfo;
- static GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ static GrGeometryProcessor* Create(GrColor,
+ GrPrimitiveEdgeType edgeType,
const DashInfo& info,
SkScalar radius);
@@ -483,7 +484,8 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker&) const SK_OVERRIDE;
private:
- DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar radius);
+ DashingCircleEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& info,
+ SkScalar radius);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
@@ -599,13 +601,15 @@
//////////////////////////////////////////////////////////////////////////////
-GrGeometryProcessor* DashingCircleEffect::Create(GrPrimitiveEdgeType edgeType, const DashInfo& info,
+GrGeometryProcessor* DashingCircleEffect::Create(GrColor color,
+ GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
SkScalar radius) {
if (info.fCount != 2 || info.fIntervals[0] != 0) {
return NULL;
}
- return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius));
+ return SkNEW_ARGS(DashingCircleEffect, (color, edgeType, info, radius));
}
DashingCircleEffect::~DashingCircleEffect() {}
@@ -624,9 +628,11 @@
return SkNEW_ARGS(GLDashingCircleEffect, (*this, bt));
}
-DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info,
+DashingCircleEffect::DashingCircleEffect(GrColor color,
+ GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
SkScalar radius)
- : fEdgeType(edgeType) {
+ : INHERITED(color), fEdgeType(edgeType) {
this->initClassID<DashingCircleEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInCoord = &this->addVertexAttrib(GrAttribute("inCoord", kVec2f_GrVertexAttribType));
@@ -662,7 +668,7 @@
info.fIntervals[1] = random->nextRangeScalar(0, 10.f);
info.fPhase = random->nextRangeScalar(0, info.fIntervals[1]);
- return DashingCircleEffect::Create(edgeType, info, strokeWidth);
+ return DashingCircleEffect::Create(GrRandomColor(random), edgeType, info, strokeWidth);
}
//////////////////////////////////////////////////////////////////////////////
@@ -682,7 +688,8 @@
public:
typedef SkPathEffect::DashInfo DashInfo;
- static GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ static GrGeometryProcessor* Create(GrColor,
+ GrPrimitiveEdgeType edgeType,
const DashInfo& info,
SkScalar strokeWidth);
@@ -707,7 +714,8 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth);
+ DashingLineEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& info,
+ SkScalar strokeWidth);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
@@ -836,14 +844,15 @@
//////////////////////////////////////////////////////////////////////////////
-GrGeometryProcessor* DashingLineEffect::Create(GrPrimitiveEdgeType edgeType,
+GrGeometryProcessor* DashingLineEffect::Create(GrColor color,
+ GrPrimitiveEdgeType edgeType,
const DashInfo& info,
SkScalar strokeWidth) {
if (info.fCount != 2) {
return NULL;
}
- return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth));
+ return SkNEW_ARGS(DashingLineEffect, (color, edgeType, info, strokeWidth));
}
DashingLineEffect::~DashingLineEffect() {}
@@ -862,9 +871,11 @@
return SkNEW_ARGS(GLDashingLineEffect, (*this, bt));
}
-DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info,
+DashingLineEffect::DashingLineEffect(GrColor color,
+ GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
SkScalar strokeWidth)
- : fEdgeType(edgeType) {
+ : INHERITED(color), fEdgeType(edgeType) {
this->initClassID<DashingLineEffect>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
fInCoord = &this->addVertexAttrib(GrAttribute("inCoord", kVec2f_GrVertexAttribType));
@@ -900,20 +911,21 @@
info.fIntervals[1] = random->nextRangeScalar(0, 10.f);
info.fPhase = random->nextRangeScalar(0, info.fIntervals[0] + info.fIntervals[1]);
- return DashingLineEffect::Create(edgeType, info, strokeWidth);
+ return DashingLineEffect::Create(GrRandomColor(random), edgeType, info, strokeWidth);
}
//////////////////////////////////////////////////////////////////////////////
-GrGeometryProcessor* GrDashingEffect::Create(GrPrimitiveEdgeType edgeType,
+GrGeometryProcessor* GrDashingEffect::Create(GrColor color,
+ GrPrimitiveEdgeType edgeType,
const SkPathEffect::DashInfo& info,
SkScalar strokeWidth,
GrDashingEffect::DashCap cap) {
switch (cap) {
case GrDashingEffect::kRound_DashCap:
- return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(strokeWidth));
+ return DashingCircleEffect::Create(color, edgeType, info, SkScalarHalf(strokeWidth));
case GrDashingEffect::kNonRound_DashCap:
- return DashingLineEffect::Create(edgeType, info, strokeWidth);
+ return DashingLineEffect::Create(color, edgeType, info, strokeWidth);
default:
SkFAIL("Unexpected dashed cap.");
}
diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h
index 14df1ae..492c690 100644
--- a/src/gpu/effects/GrDashingEffect.h
+++ b/src/gpu/effects/GrDashingEffect.h
@@ -9,6 +9,7 @@
#ifndef GrDashingEffect_DEFINED
#define GrDashingEffect_DEFINED
+#include "GrColor.h"
#include "GrTypesPriv.h"
#include "SkPathEffect.h"
@@ -23,7 +24,7 @@
class SkPath;
namespace GrDashingEffect {
- bool DrawDashLine(GrGpu*, GrDrawTarget*, GrDrawState*, const SkPoint pts[2],
+ bool DrawDashLine(GrGpu*, GrDrawTarget*, GrDrawState*, GrColor, const SkPoint pts[2],
const GrPaint& paint, const GrStrokeInfo& strokeInfo,
const SkMatrix& vm);
@@ -38,7 +39,8 @@
* Bounding geometry is rendered and the effect computes coverage based on the fragment's
* position relative to the dashed line.
*/
- GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ GrGeometryProcessor* Create(GrColor,
+ GrPrimitiveEdgeType edgeType,
const SkPathEffect::DashInfo& info,
SkScalar strokeWidth,
DashCap cap);
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index eff2ee5..f408d2d 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -165,7 +165,8 @@
///////////////////////////////////////////////////////////////////////////////
-GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrTexture* texture,
+GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrColor color,
+ GrTexture* texture,
const GrTextureParams& params,
#ifdef SK_GAMMA_APPLY_TO_A8
GrTexture* gamma,
@@ -173,7 +174,8 @@
float luminance,
#endif
uint32_t flags)
- : fTextureAccess(texture, params)
+ : INHERITED(color)
+ , fTextureAccess(texture, params)
#ifdef SK_GAMMA_APPLY_TO_A8
, fGammaTextureAccess(gamma, gammaParams)
, fLuminance(luminance)
@@ -249,7 +251,7 @@
GrTextureParams::kNone_FilterMode);
#endif
- return GrDistanceFieldTextureEffect::Create(textures[texIdx], params,
+ return GrDistanceFieldTextureEffect::Create(GrRandomColor(random), textures[texIdx], params,
#ifdef SK_GAMMA_APPLY_TO_A8
textures[texIdx2], params2,
random->nextF(),
@@ -378,10 +380,13 @@
///////////////////////////////////////////////////////////////////////////////
-GrDistanceFieldNoGammaTextureEffect::GrDistanceFieldNoGammaTextureEffect(GrTexture* texture,
- const GrTextureParams& params,
- uint32_t flags)
- : fTextureAccess(texture, params)
+GrDistanceFieldNoGammaTextureEffect::GrDistanceFieldNoGammaTextureEffect(
+ GrColor color,
+ GrTexture* texture,
+ const GrTextureParams& params,
+ uint32_t flags)
+ : INHERITED(color)
+ , fTextureAccess(texture, params)
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
, fInColor(NULL) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
@@ -439,7 +444,8 @@
GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode
: GrTextureParams::kNone_FilterMode);
- return GrDistanceFieldNoGammaTextureEffect::Create(textures[texIdx], params,
+ return GrDistanceFieldNoGammaTextureEffect::Create(GrRandomColor(random), textures[texIdx],
+ params,
random->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0);
}
@@ -634,11 +640,13 @@
///////////////////////////////////////////////////////////////////////////////
GrDistanceFieldLCDTextureEffect::GrDistanceFieldLCDTextureEffect(
+ GrColor color,
GrTexture* texture, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gParams,
SkColor textColor,
uint32_t flags)
- : fTextureAccess(texture, params)
+ : INHERITED(color)
+ , fTextureAccess(texture, params)
, fGammaTextureAccess(gamma, gParams)
, fTextColor(textColor)
, fFlags(flags & kLCD_DistanceFieldEffectMask){
@@ -705,7 +713,7 @@
uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
- return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params,
+ return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), textures[texIdx], params,
textures[texIdx2], params2,
textColor,
flags);
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h
index 1dfa1b4..f0f7e3b 100644
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.h
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h
@@ -47,16 +47,16 @@
class GrDistanceFieldTextureEffect : public GrGeometryProcessor {
public:
#ifdef SK_GAMMA_APPLY_TO_A8
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams,
float lum, uint32_t flags) {
- return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, gamma, gammaParams, lum,
+ return SkNEW_ARGS(GrDistanceFieldTextureEffect, (color, tex, params, gamma, gammaParams, lum,
flags));
}
#else
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& params,
uint32_t flags) {
- return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, flags));
+ return SkNEW_ARGS(GrDistanceFieldTextureEffect, (color, tex, params, flags));
}
#endif
@@ -79,7 +79,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& params,
+ GrDistanceFieldTextureEffect(GrColor, GrTexture* texture, const GrTextureParams& params,
#ifdef SK_GAMMA_APPLY_TO_A8
GrTexture* gamma, const GrTextureParams& gammaParams, float lum,
#endif
@@ -113,9 +113,9 @@
*/
class GrDistanceFieldNoGammaTextureEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& params,
uint32_t flags) {
- return SkNEW_ARGS(GrDistanceFieldNoGammaTextureEffect, (tex, params, flags));
+ return SkNEW_ARGS(GrDistanceFieldNoGammaTextureEffect, (color, tex, params, flags));
}
virtual ~GrDistanceFieldNoGammaTextureEffect() {}
@@ -134,7 +134,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrDistanceFieldNoGammaTextureEffect(GrTexture* texture, const GrTextureParams& params,
+ GrDistanceFieldNoGammaTextureEffect(GrColor, GrTexture* texture, const GrTextureParams& params,
uint32_t flags);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
@@ -160,11 +160,11 @@
*/
class GrDistanceFieldLCDTextureEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams,
SkColor textColor, uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
- (tex, params, gamma, gammaParams, textColor, flags));
+ (color, tex, params, gamma, gammaParams, textColor, flags));
}
virtual ~GrDistanceFieldLCDTextureEffect() {}
@@ -183,7 +183,7 @@
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& params,
+ GrDistanceFieldLCDTextureEffect(GrColor, GrTexture* texture, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams,
SkColor textColor,
uint32_t flags);