From 88c23fc6e8ed0243159fd17d815b4f813805647b Mon Sep 17 00:00:00 2001 From: joshualitt Date: Wed, 13 May 2015 14:18:07 -0700 Subject: [PATCH] remove color from GrGeometryProcessor BUG=skia: Review URL: https://codereview.chromium.org/1140983002 --- gm/beziereffects.cpp | 25 +++++++++++++++++++------ gm/convexpolyeffect.cpp | 13 +++++++++---- src/gpu/GrAAConvexPathRenderer.cpp | 5 ++++- src/gpu/GrDefaultGeoProcFactory.cpp | 5 ++++- src/gpu/GrGeometryProcessor.h | 11 +---------- src/gpu/GrOvalRenderer.cpp | 15 ++++++++++++--- src/gpu/GrTestBatch.h | 3 ++- src/gpu/effects/GrBezierEffect.cpp | 10 +++++++--- src/gpu/effects/GrBezierEffect.h | 16 +++++++++++----- src/gpu/effects/GrBitmapTextGeoProc.cpp | 3 ++- src/gpu/effects/GrBitmapTextGeoProc.h | 2 ++ src/gpu/effects/GrDashingEffect.cpp | 14 ++++++++++++-- src/gpu/effects/GrDistanceFieldGeoProc.cpp | 9 ++++++--- src/gpu/effects/GrDistanceFieldGeoProc.h | 10 ++++++++-- 14 files changed, 99 insertions(+), 42 deletions(-) diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 9ab4cd3..5070eea 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -64,6 +64,11 @@ private: return &fGeometry; } + const Geometry* geoData(int index) const override { + SkASSERT(0 == index); + return &fGeometry; + } + void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { QuadHelper helper; size_t vertexStride = this->geometryProcessor()->getVertexStride(); @@ -138,6 +143,7 @@ protected: SkScalar h = SkIntToScalar(rt->height()) / numRows; int row = 0; int col = 0; + static const GrColor color = 0xff000000; for (int i = 0; i < kNumCubics; ++i) { SkPoint baseControlPts[] = { @@ -155,7 +161,7 @@ protected: continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; - gp.reset(GrCubicEffect::Create(0xff000000, SkMatrix::I(), et, + gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, *tt.target()->caps())); if (!gp) { continue; @@ -217,7 +223,7 @@ protected: pipelineBuilder.setRenderTarget(rt); BezierCubicOrConicTestBatch::Geometry geometry; - geometry.fColor = gp->color(); + geometry.fColor = color; geometry.fBounds = bounds; SkAutoTUnref batch( @@ -285,6 +291,7 @@ protected: SkScalar h = SkIntToScalar(rt->height()) / numRows; int row = 0; int col = 0; + static const GrColor color = 0xff000000; for (int i = 0; i < kNumConics; ++i) { SkPoint baseControlPts[] = { @@ -302,7 +309,7 @@ protected: continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; - gp.reset(GrConicEffect::Create(0xff000000, SkMatrix::I(), et, + gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, *tt.target()->caps(), SkMatrix::I())); if (!gp) { continue; @@ -361,7 +368,7 @@ protected: pipelineBuilder.setRenderTarget(rt); BezierCubicOrConicTestBatch::Geometry geometry; - geometry.fColor = gp->color(); + geometry.fColor = color; geometry.fBounds = bounds; SkAutoTUnref batch( @@ -452,6 +459,11 @@ private: return &fGeometry; } + const Geometry* geoData(int index) const override { + SkASSERT(0 == index); + return &fGeometry; + } + void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { QuadHelper helper; size_t vertexStride = this->geometryProcessor()->getVertexStride(); @@ -520,6 +532,7 @@ protected: SkScalar h = SkIntToScalar(rt->height()) / numRows; int row = 0; int col = 0; + static const GrColor color = 0xff000000; for (int i = 0; i < kNumQuads; ++i) { SkPoint baseControlPts[] = { @@ -536,7 +549,7 @@ protected: continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; - gp.reset(GrQuadEffect::Create(0xff000000, SkMatrix::I(), et, + gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, *tt.target()->caps(), SkMatrix::I())); if (!gp) { continue; @@ -594,7 +607,7 @@ protected: GrPathUtils::QuadUVMatrix DevToUV(pts); BezierQuadTestBatch::Geometry geometry; - geometry.fColor = gp->color(); + geometry.fColor = color; geometry.fBounds = bounds; SkAutoTUnref batch(BezierQuadTestBatch::Create(gp, geometry, DevToUV)); diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index b9c07d2..9c6741a 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -50,6 +50,11 @@ private: return &fGeometry; } + const Geometry* geoData(int index) const override { + SkASSERT(0 == index); + return &fGeometry; + } + void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { size_t vertexStride = this->geometryProcessor()->getVertexStride(); SkASSERT(vertexStride == sizeof(SkPoint)); @@ -151,9 +156,9 @@ protected: return; } + static const GrColor color = 0xff000000; SkAutoTUnref gp( - GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType, - 0xff000000)); + GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType, color)); SkScalar y = 0; for (SkTLList::Iter iter(fPaths, SkTLList::Iter::kHead_IterStart); @@ -184,7 +189,7 @@ protected: pipelineBuilder.setRenderTarget(rt); ConvexPolyTestBatch::Geometry geometry; - geometry.fColor = gp->color(); + geometry.fColor = color; geometry.fBounds = p.getBounds(); SkAutoTUnref batch(ConvexPolyTestBatch::Create(gp, geometry)); @@ -233,7 +238,7 @@ protected: pipelineBuilder.setRenderTarget(rt); ConvexPolyTestBatch::Geometry geometry; - geometry.fColor = gp->color(); + geometry.fColor = color; geometry.fBounds = rect; SkAutoTUnref batch(ConvexPolyTestBatch::Create(gp, geometry)); diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 1423546..e9a58ac 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -535,6 +535,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inQuadEdge() const { return fInQuadEdge; } + GrColor color() const { return fColor; } class GLProcessor : public GrGLGeometryProcessor { public: @@ -643,7 +644,8 @@ public: private: QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix) { + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVertexAttribType)); @@ -657,6 +659,7 @@ private: const Attribute* fInPosition; const Attribute* fInQuadEdge; + GrColor fColor; GR_DECLARE_GEOMETRY_PROCESSOR_TEST; diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index 0734464..9f5eb37 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -38,6 +38,7 @@ public: const Attribute* inColor() const { return fInColor; } const Attribute* inLocalCoords() const { return fInLocalCoords; } const Attribute* inCoverage() const { return fInCoverage; } + GrColor color() const { return fColor; } uint8_t coverage() const { return fCoverage; } void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override { @@ -168,11 +169,12 @@ private: const SkMatrix& viewMatrix, const SkMatrix& localMatrix, uint8_t coverage) - : INHERITED(color, viewMatrix, localMatrix) + : INHERITED(viewMatrix, localMatrix) , fInPosition(NULL) , fInColor(NULL) , fInLocalCoords(NULL) , fInCoverage(NULL) + , fColor(color) , fCoverage(coverage) , fFlags(gpTypeFlags) { this->initClassID(); @@ -206,6 +208,7 @@ private: const Attribute* fInColor; const Attribute* fInLocalCoords; const Attribute* fInCoverage; + GrColor fColor; uint8_t fCoverage; uint32_t fFlags; diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h index c380f20..1c7fc99 100644 --- a/src/gpu/GrGeometryProcessor.h +++ b/src/gpu/GrGeometryProcessor.h @@ -19,13 +19,9 @@ */ class GrGeometryProcessor : public GrPrimitiveProcessor { public: - // TODO the Hint can be handled in a much more clean way when we have deferred geometry or - // atleast bundles - GrGeometryProcessor(GrColor color, - const SkMatrix& viewMatrix = SkMatrix::I(), + GrGeometryProcessor(const SkMatrix& viewMatrix = SkMatrix::I(), const SkMatrix& localMatrix = SkMatrix::I()) : INHERITED(viewMatrix, localMatrix, false) - , fColor(color) , fWillUseGeoShader(false) , fHasLocalCoords(false) {} @@ -38,10 +34,6 @@ public: SkFAIL("Unsupported\n"); return false; } - - // TODO we can remove color from the GrGeometryProcessor base class once we have bundles of - // primitive data - GrColor color() const { return fColor; } // TODO Delete when paths are in batch void getInvariantOutputColor(GrInitInvariantOutput* out) const override { @@ -105,7 +97,6 @@ protected: private: bool hasExplicitLocalCoords() const override { return fHasLocalCoords; } - GrColor fColor; bool fWillUseGeoShader; bool fHasLocalCoords; diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index e619859..525724d 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -77,6 +77,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inCircleEdge() const { return fInCircleEdge; } + GrColor color() const { return fColor; } virtual ~CircleEdgeEffect() {} const char* name() const override { return "CircleEdge"; } @@ -176,7 +177,8 @@ public: private: CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix) { + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge", @@ -190,6 +192,7 @@ private: bool fUsesLocalCoords; }; + GrColor fColor; const Attribute* fInPosition; const Attribute* fInCircleEdge; bool fStroke; @@ -233,6 +236,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inEllipseOffset() const { return fInEllipseOffset; } const Attribute* inEllipseRadii() const { return fInEllipseRadii; } + GrColor color() const { return fColor; } inline bool isStroked() const { return fStroke; } @@ -351,7 +355,8 @@ public: private: EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix) { + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInEllipseOffset = &this->addVertexAttrib(Attribute("inEllipseOffset", @@ -370,6 +375,7 @@ private: const Attribute* fInPosition; const Attribute* fInEllipseOffset; const Attribute* fInEllipseRadii; + GrColor fColor; bool fStroke; GR_DECLARE_GEOMETRY_PROCESSOR_TEST; @@ -414,6 +420,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; } const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } + GrColor color() const { return fColor; } inline Mode getMode() const { return fMode; } @@ -546,7 +553,8 @@ public: private: DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode) - : INHERITED(color, viewMatrix) { + : INHERITED(viewMatrix) + , fColor(color) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0", @@ -565,6 +573,7 @@ private: const Attribute* fInPosition; const Attribute* fInEllipseOffsets0; const Attribute* fInEllipseOffsets1; + GrColor fColor; Mode fMode; GR_DECLARE_GEOMETRY_PROCESSOR_TEST; diff --git a/src/gpu/GrTestBatch.h b/src/gpu/GrTestBatch.h index 41839ee..a165f4a 100644 --- a/src/gpu/GrTestBatch.h +++ b/src/gpu/GrTestBatch.h @@ -25,7 +25,7 @@ public: void getInvariantOutputColor(GrInitInvariantOutput* out) const override { // When this is called on a batch, there is only one geometry bundle - out->setKnownFourComponents(fGeometryProcessor->color()); + out->setKnownFourComponents(this->geoData(0)->fColor); } void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { @@ -74,6 +74,7 @@ protected: private: virtual Geometry* geoData(int index) = 0; + virtual const Geometry* geoData(int index) const = 0; bool onCombineIfPossible(GrBatch* t) override { return false; diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 9ab3a95..9778dd2 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -191,7 +191,8 @@ GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix) - : INHERITED(color, viewMatrix, localMatrix) + : INHERITED(viewMatrix, localMatrix) + , fColor(color) , fCoverageScale(coverage) , fEdgeType(edgeType) { this->initClassID(); @@ -395,7 +396,8 @@ GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt, GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix) - : INHERITED(color, viewMatrix, localMatrix) + : INHERITED(viewMatrix, localMatrix) + , fColor(color) , fCoverageScale(coverage) , fEdgeType(edgeType) { this->initClassID(); @@ -622,7 +624,9 @@ GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, GrPrimitiveEdgeType edgeType) - : INHERITED(color, viewMatrix), fEdgeType(edgeType) { + : INHERITED(viewMatrix) + , fColor(color) + , fEdgeType(edgeType) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h index df582b8..5f7bf1d 100644 --- a/src/gpu/effects/GrBezierEffect.h +++ b/src/gpu/effects/GrBezierEffect.h @@ -97,6 +97,7 @@ public: inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); } inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } + GrColor color() const { return fColor; } virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, @@ -111,8 +112,9 @@ private: GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType, const SkMatrix& localMatrix); - uint8_t fCoverageScale; - GrPrimitiveEdgeType fEdgeType; + GrColor fColor; + uint8_t fCoverageScale; + GrPrimitiveEdgeType fEdgeType; const Attribute* fInPosition; const Attribute* fInConicCoeffs; @@ -173,6 +175,7 @@ public: inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); } inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } + GrColor color() const { return fColor; } virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, @@ -187,8 +190,9 @@ private: GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType, const SkMatrix& localMatrix); - uint8_t fCoverageScale; - GrPrimitiveEdgeType fEdgeType; + GrColor fColor; + uint8_t fCoverageScale; + GrPrimitiveEdgeType fEdgeType; const Attribute* fInPosition; const Attribute* fInHairQuadEdge; @@ -245,6 +249,7 @@ public: inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); } inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } + GrColor color() const { return fColor; } virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, @@ -258,7 +263,8 @@ public: private: GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType); - GrPrimitiveEdgeType fEdgeType; + GrColor fColor; + GrPrimitiveEdgeType fEdgeType; const Attribute* fInPosition; const Attribute* fInCubicCoeffs; diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index ade0904..a5d8ba9 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -119,7 +119,8 @@ private: GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, const GrTextureParams& params, GrMaskFormat format, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix) + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) , fTextureAccess(texture, params) , fInColor(NULL) , fMaskFormat(format) { diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h index d2d0422..dc4e1a8 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.h +++ b/src/gpu/effects/GrBitmapTextGeoProc.h @@ -35,6 +35,7 @@ public: const Attribute* inColor() const { return fInColor; } const Attribute* inTextureCoords() const { return fInTextureCoords; } GrMaskFormat maskFormat() const { return fMaskFormat; } + GrColor color() const { return fColor; } virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, @@ -49,6 +50,7 @@ private: GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params, GrMaskFormat format, const SkMatrix& localMatrix); + GrColor fColor; GrTextureAccess fTextureAccess; const Attribute* fInPosition; const Attribute* fInColor; diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index d3df886..588a8f0 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -783,6 +783,8 @@ public: DashAAMode aaMode() const { return fAAMode; } + GrColor color() const { return fColor; } + virtual void getGLProcessorKey(const GrBatchTracker&, const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override; @@ -795,6 +797,7 @@ public: private: DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); + GrColor fColor; DashAAMode fAAMode; const Attribute* fInPosition; const Attribute* fInDashParams; @@ -937,7 +940,9 @@ GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack DashingCircleEffect::DashingCircleEffect(GrColor color, DashAAMode aaMode, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix), fAAMode(aaMode) { + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) + , fAAMode(aaMode) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVertexAttribType)); @@ -999,6 +1004,8 @@ public: DashAAMode aaMode() const { return fAAMode; } + GrColor color() const { return fColor; } + virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; @@ -1011,6 +1018,7 @@ public: private: DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); + GrColor fColor; DashAAMode fAAMode; const Attribute* fInPosition; const Attribute* fInDashParams; @@ -1165,7 +1173,9 @@ GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker DashingLineEffect::DashingLineEffect(GrColor color, DashAAMode aaMode, const SkMatrix& localMatrix) - : INHERITED(color, SkMatrix::I(), localMatrix), fAAMode(aaMode) { + : INHERITED(SkMatrix::I(), localMatrix) + , fColor(color) + , fAAMode(aaMode) { this->initClassID(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVertexAttribType)); diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index bd48e51..adcb6a6 100755 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -197,7 +197,8 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, float distanceAdjust, #endif uint32_t flags) - : INHERITED(color, viewMatrix, SkMatrix::I()) + : INHERITED(viewMatrix, SkMatrix::I()) + , fColor(color) , fTextureAccess(texture, params) #ifdef SK_GAMMA_APPLY_TO_A8 , fDistanceAdjust(distanceAdjust) @@ -423,7 +424,8 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( GrTexture* texture, const GrTextureParams& params, uint32_t flags) - : INHERITED(color, viewMatrix, SkMatrix::I()) + : INHERITED(viewMatrix, SkMatrix::I()) + , fColor(color) , fTextureAccess(texture, params) , fFlags(flags & kNonLCD_DistanceFieldEffectMask) , fInColor(NULL) { @@ -691,7 +693,8 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( GrTexture* texture, const GrTextureParams& params, DistanceAdjust distanceAdjust, uint32_t flags) - : INHERITED(color, viewMatrix, SkMatrix::I()) + : INHERITED(viewMatrix, SkMatrix::I()) + , fColor(color) , fTextureAccess(texture, params) , fDistanceAdjust(distanceAdjust) , fFlags(flags & kLCD_DistanceFieldEffectMask){ diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h index 44f0283..92e48ee 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.h +++ b/src/gpu/effects/GrDistanceFieldGeoProc.h @@ -68,6 +68,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inColor() const { return fInColor; } const Attribute* inTextureCoords() const { return fInTextureCoords; } + GrColor color() const { return fColor; } #ifdef SK_GAMMA_APPLY_TO_A8 float getDistanceAdjust() const { return fDistanceAdjust; } #endif @@ -90,6 +91,7 @@ private: #endif uint32_t flags); + GrColor fColor; GrTextureAccess fTextureAccess; #ifdef SK_GAMMA_APPLY_TO_A8 float fDistanceAdjust; @@ -126,6 +128,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inColor() const { return fInColor; } const Attribute* inTextureCoords() const { return fInTextureCoords; } + GrColor color() const { return fColor; } uint32_t getFlags() const { return fFlags; } virtual void getGLProcessorKey(const GrBatchTracker& bt, @@ -141,8 +144,9 @@ private: GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture, const GrTextureParams& params, uint32_t flags); - GrTextureAccess fTextureAccess; - uint32_t fFlags; + GrColor fColor; + GrTextureAccess fTextureAccess; + uint32_t fFlags; const Attribute* fInPosition; const Attribute* fInColor; const Attribute* fInTextureCoords; @@ -189,6 +193,7 @@ public: const Attribute* inPosition() const { return fInPosition; } const Attribute* inTextureCoords() const { return fInTextureCoords; } DistanceAdjust getDistanceAdjust() const { return fDistanceAdjust; } + GrColor color() const { return fColor; } uint32_t getFlags() const { return fFlags; } virtual void getGLProcessorKey(const GrBatchTracker& bt, @@ -205,6 +210,7 @@ private: GrTexture* texture, const GrTextureParams& params, DistanceAdjust wa, uint32_t flags); + GrColor fColor; GrTextureAccess fTextureAccess; DistanceAdjust fDistanceAdjust; uint32_t fFlags; -- 2.7.4