diff options
Diffstat (limited to 'src/gpu')
30 files changed, 260 insertions, 201 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index dc74459e3e..1aa90c3f2b 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -517,11 +517,6 @@ public: static const char* Name() { return "QuadEdge"; } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - const GrShaderVar& inQuadEdge() const { return fInQuadEdge; } virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE { @@ -593,6 +588,11 @@ private: return true; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + const GrShaderVar& fInQuadEdge; GR_DECLARE_GEOMETRY_PROCESSOR_TEST; diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp index 572098249e..0b895d1d33 100644 --- a/src/gpu/GrAARectRenderer.cpp +++ b/src/gpu/GrAARectRenderer.cpp @@ -30,11 +30,6 @@ public: static const char* Name() { return "AlignedRectEdge"; } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - const GrShaderVar& inRect() const { return fInRect; } virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE { @@ -112,6 +107,11 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + GR_DECLARE_GEOMETRY_PROCESSOR_TEST; typedef GrGeometryProcessor INHERITED; @@ -155,11 +155,6 @@ public: static const char* Name() { return "RectEdge"; } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - const GrShaderVar& inRectEdge() const { return fInRectEdge; } const GrShaderVar& inWidthHeight() const { return fInWidthHeight; } @@ -257,6 +252,11 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + const GrShaderVar& fInRectEdge; const GrShaderVar& fInWidthHeight; diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp index 872d20a1ab..b4cf9c8b41 100644 --- a/src/gpu/GrDrawState.cpp +++ b/src/gpu/GrDrawState.cpp @@ -421,26 +421,26 @@ bool GrDrawState::hasSolidCoverage() const { return true; } - GrColor coverage; - uint32_t validComponentFlags; + GrProcessor::InvariantOutput inout; + inout.fIsSingleComponent = false; // Initialize to an unknown starting coverage if per-vertex coverage is specified. if (this->hasCoverageVertexAttribute()) { - validComponentFlags = 0; + inout.fValidFlags = 0; } else { - coverage = fCoverage; - validComponentFlags = kRGBA_GrColorComponentFlags; + inout.fColor = fCoverage; + inout.fValidFlags = kRGBA_GrColorComponentFlags; } // Run through the coverage stages and see if the coverage will be all ones at the end. if (this->hasGeometryProcessor()) { const GrGeometryProcessor* gp = fGeometryProcessor->getGeometryProcessor(); - gp->getConstantColorComponents(&coverage, &validComponentFlags); + gp->computeInvariantOutput(&inout); } for (int s = 0; s < this->numCoverageStages(); ++s) { const GrProcessor* processor = this->getCoverageStage(s).getProcessor(); - processor->getConstantColorComponents(&coverage, &validComponentFlags); + processor->computeInvariantOutput(&inout); } - return (kRGBA_GrColorComponentFlags == validComponentFlags) && (0xffffffff == coverage); + return inout.isSolidWhite(); } ////////////////////////////////////////////////////////////////////////////// @@ -755,55 +755,54 @@ GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage, bool GrDrawState::srcAlphaWillBeOne() const { - uint32_t validComponentFlags; - GrColor color; + GrProcessor::InvariantOutput inoutColor; + inoutColor.fIsSingleComponent = false; // Check if per-vertex or constant color may have partial alpha if (this->hasColorVertexAttribute()) { if (fHints & kVertexColorsAreOpaque_Hint) { - validComponentFlags = kA_GrColorComponentFlag; - color = 0xFF << GrColor_SHIFT_A; + inoutColor.fValidFlags = kA_GrColorComponentFlag; + inoutColor.fColor = 0xFF << GrColor_SHIFT_A; } else { - validComponentFlags = 0; - color = 0; // not strictly necessary but we get false alarms from tools about uninit. + inoutColor.fValidFlags = 0; + // not strictly necessary but we get false alarms from tools about uninit. + inoutColor.fColor = 0; } } else { - validComponentFlags = kRGBA_GrColorComponentFlags; - color = this->getColor(); + inoutColor.fValidFlags = kRGBA_GrColorComponentFlags; + inoutColor.fColor = this->getColor(); } // Run through the color stages for (int s = 0; s < this->numColorStages(); ++s) { const GrProcessor* processor = this->getColorStage(s).getProcessor(); - processor->getConstantColorComponents(&color, &validComponentFlags); + processor->computeInvariantOutput(&inoutColor); } // Check whether coverage is treated as color. If so we run through the coverage computation. if (this->isCoverageDrawing()) { // The shader generated for coverage drawing runs the full coverage computation and then // makes the shader output be the multiplication of color and coverage. We mirror that here. - GrColor coverage; - uint32_t coverageComponentFlags; + GrProcessor::InvariantOutput inoutCoverage; + inoutCoverage.fIsSingleComponent = false; if (this->hasCoverageVertexAttribute()) { - coverageComponentFlags = 0; - coverage = 0; // suppresses any warnings. + inoutCoverage.fValidFlags = 0; + inoutCoverage.fColor = 0; // suppresses any warnings. } else { - coverageComponentFlags = kRGBA_GrColorComponentFlags; - coverage = this->getCoverageColor(); + inoutCoverage.fValidFlags = kRGBA_GrColorComponentFlags; + inoutCoverage.fColor = this->getCoverageColor(); } // Run through the coverage stages for (int s = 0; s < this->numCoverageStages(); ++s) { const GrProcessor* processor = this->getCoverageStage(s).getProcessor(); - processor->getConstantColorComponents(&coverage, &coverageComponentFlags); + processor->computeInvariantOutput(&inoutCoverage); } // Since the shader will multiply coverage and color, the only way the final A==1 is if // coverage and color both have A==1. - return (kA_GrColorComponentFlag & validComponentFlags & coverageComponentFlags) && - 0xFF == GrColorUnpackA(color) && 0xFF == GrColorUnpackA(coverage); - + return (inoutColor.isOpaque() && inoutCoverage.isOpaque()); } - return (kA_GrColorComponentFlag & validComponentFlags) && 0xFF == GrColorUnpackA(color); + return inoutColor.isOpaque(); } diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp index 98a5689d53..6a79203d1a 100644 --- a/src/gpu/GrOptDrawState.cpp +++ b/src/gpu/GrOptDrawState.cpp @@ -170,18 +170,19 @@ void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) { int firstColorStage = 0; // Set up color and flags for ConstantColorComponent checks - GrColor color; - uint32_t validComponentFlags; + GrProcessor::InvariantOutput inout; + inout.fIsSingleComponent = false; if (!this->hasColorVertexAttribute()) { - color = ds.getColor(); - validComponentFlags = kRGBA_GrColorComponentFlags; + inout.fColor = ds.getColor(); + inout.fValidFlags = kRGBA_GrColorComponentFlags; } else { if (ds.vertexColorsAreOpaque()) { - color = 0xFF << GrColor_SHIFT_A; - validComponentFlags = kA_GrColorComponentFlag; + inout.fColor = 0xFF << GrColor_SHIFT_A; + inout.fValidFlags = kA_GrColorComponentFlag; } else { - validComponentFlags = 0; - color = 0; // not strictly necessary but we get false alarms from tools about uninit. + inout.fValidFlags = 0; + // not strictly necessary but we get false alarms from tools about uninit. + inout.fColor = 0; } } @@ -191,10 +192,10 @@ void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) { firstColorStage = i; fInputColorIsUsed = false; } - fp->getConstantColorComponents(&color, &validComponentFlags); - if (kRGBA_GrColorComponentFlags == validComponentFlags) { + fp->computeInvariantOutput(&inout); + if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { firstColorStage = i + 1; - fColor = color; + fColor = inout.fColor; fInputColorIsUsed = true; this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribBinding); } diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index 4ae0ebc7ef..7a84f80805 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -75,11 +75,6 @@ public: } } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - const GrShaderVar& inCircleEdge() const { return fInCircleEdge; } virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE { @@ -150,6 +145,11 @@ private: return cee.fStroke == fStroke; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + const GrShaderVar& fInCircleEdge; bool fStroke; @@ -192,11 +192,6 @@ public: } } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE { return GrTBackendGeometryProcessorFactory<EllipseEdgeEffect>::getInstance(); } @@ -291,6 +286,11 @@ private: return eee.fStroke == fStroke; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + const GrShaderVar& fInEllipseOffset; const GrShaderVar& fInEllipseRadii; bool fStroke; @@ -341,11 +341,6 @@ public: } } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE { return GrTBackendGeometryProcessorFactory<DIEllipseEdgeEffect>::getInstance(); } @@ -460,6 +455,11 @@ private: return eee.fMode == fMode; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + const GrShaderVar& fInEllipseOffsets0; const GrShaderVar& fInEllipseOffsets1; Mode fMode; diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index 84fdf420e2..ffde5f99e4 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -52,28 +52,32 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, // TODO: Share this implementation with GrDrawState - GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); - uint32_t coverageComps = kRGBA_GrColorComponentFlags; + GrProcessor::InvariantOutput inout; + inout.fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); + inout.fValidFlags = kRGBA_GrColorComponentFlags; + inout.fIsSingleComponent = false; int count = fCoverageStages.count(); for (int i = 0; i < count; ++i) { - fCoverageStages[i].getProcessor()->getConstantColorComponents(&coverage, &coverageComps); + fCoverageStages[i].getProcessor()->computeInvariantOutput(&inout); } - if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage) { + if (!inout.isSolidWhite()) { return false; } - GrColor color = fColor; - uint32_t colorComps = kRGBA_GrColorComponentFlags; + inout.fColor = fColor; + inout.fValidFlags = kRGBA_GrColorComponentFlags; + inout.fIsSingleComponent = false; count = fColorStages.count(); for (int i = 0; i < count; ++i) { - fColorStages[i].getProcessor()->getConstantColorComponents(&color, &colorComps); + fColorStages[i].getProcessor()->computeInvariantOutput(&inout); } SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents)); GrBlendCoeff srcCoeff = fSrcBlendCoeff; GrBlendCoeff dstCoeff = fDstBlendCoeff; - GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0); + GrSimplifyBlend(&srcCoeff, &dstCoeff, inout.fColor, inout.fValidFlags, + 0, 0, 0); bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoeff); if (solidColor) { @@ -85,8 +89,8 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, break; case kOne_GrBlendCoeff: - *solidColor = color; - *solidColorKnownComponents = colorComps; + *solidColor = inout.fColor; + *solidColorKnownComponents = inout.fValidFlags; break; // The src coeff should never refer to the src and if it refers to dst then opaque diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 45298b522d..26e00530be 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -88,4 +88,46 @@ void GrProcessor::assertEquality(const GrProcessor& other) const { SkASSERT(this->textureAccess(i) == other.textureAccess(i)); } } + +void GrProcessor::InvariantOutput::validate() const { + if (fIsSingleComponent) { + SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags); + if (kRGBA_GrColorComponentFlags == fValidFlags) { + SkASSERT(this->colorComponentsAllEqual()); + } + } + + SkASSERT(this->validPreMulColor()); +} + +bool GrProcessor::InvariantOutput::colorComponentsAllEqual() const { + unsigned colorA = GrColorUnpackA(fColor); + return(GrColorUnpackR(fColor) == colorA && + GrColorUnpackG(fColor) == colorA && + GrColorUnpackB(fColor) == colorA); +} + +bool GrProcessor::InvariantOutput::validPreMulColor() const { + if (kA_GrColorComponentFlag & fValidFlags) { + float c[4]; + GrColorToRGBAFloat(fColor, c); + if (kR_GrColorComponentFlag & fValidFlags) { + if (c[0] > c[3]) { + return false; + } + } + if (kG_GrColorComponentFlag & fValidFlags) { + if (c[1] > c[3]) { + return false; + } + } + if (kB_GrColorComponentFlag & fValidFlags) { + if (c[2] > c[3]) { + return false; + } + } + } + return true; +} #endif + diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h index cb79ac39c5..4631a2ca8e 100644 --- a/src/gpu/effects/GrBezierEffect.h +++ b/src/gpu/effects/GrBezierEffect.h @@ -97,11 +97,6 @@ public: typedef GrGLConicEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -109,6 +104,11 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + GrPrimitiveEdgeType fEdgeType; const GrShaderVar& fInConicCoeffs; @@ -170,11 +170,6 @@ public: typedef GrGLQuadEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -182,6 +177,11 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + GrPrimitiveEdgeType fEdgeType; const GrShaderVar& fInHairQuadEdge; @@ -245,11 +245,6 @@ public: typedef GrGLCubicEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - *validFlags = 0; - } - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -257,6 +252,11 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + GrPrimitiveEdgeType fEdgeType; const GrShaderVar& fInCubicCoeffs; diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index d73e604b04..f5cc9d1218 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -169,9 +169,10 @@ bool GrBicubicEffect::onIsEqual(const GrProcessor& sBase) const { fDomain == s.fDomain; } -void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { +void GrBicubicEffect::onComputeInvariantOutput(InvariantOutput* inout) const { // FIXME: Perhaps we can do better. - *validFlags = 0; + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; return; } diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 03476da38f..e36aa8d1d5 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -29,7 +29,6 @@ public: typedef GrGLBicubicEffect GLProcessor; virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; const GrTextureDomain& domain() const { return fDomain; } @@ -93,6 +92,8 @@ private: const SkMatrix &matrix, const SkRect& domain); virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + float fCoefficients[16]; GrTextureDomain fDomain; diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 3042d86f03..f60be2a970 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -126,9 +126,9 @@ bool GrConfigConversionEffect::onIsEqual(const GrProcessor& s) const { other.fPMConversion == fPMConversion; } -void GrConfigConversionEffect::getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const { - this->updateConstantColorComponentsForModulation(color, validFlags); +void GrConfigConversionEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + this->updateInvariantOutputForModulation(inout); + inout->fIsSingleComponent = false; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index 765e49b45b..aa2c87482e 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -43,8 +43,6 @@ public: virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - bool swapsRedAndBlue() const { return fSwapRedAndBlue; } PMConversion pmConversion() const { return fPMConversion; } @@ -65,6 +63,8 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + bool fSwapRedAndBlue; PMConversion fPMConversion; diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index 4857a9e96d..836596a761 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -29,17 +29,6 @@ public: return SkNEW_ARGS(AARectEffect, (edgeType, rect)); } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - if (fRect.isEmpty()) { - // An empty rect will have no coverage anywhere. - *color = 0x00000000; - *validFlags = kRGBA_GrColorComponentFlags; - } else { - *validFlags = 0; - } - } - GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; @@ -54,6 +43,17 @@ private: return fRect == aare.fRect; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + if (fRect.isEmpty()) { + // An empty rect will have no coverage anywhere. + inout->fColor = 0x00000000; + inout->fValidFlags = kRGBA_GrColorComponentFlags; + } else { + inout->fValidFlags = 0; + } + inout->fIsSingleComponent = false; + } + SkRect fRect; GrPrimitiveEdgeType fEdgeType; @@ -328,8 +328,9 @@ GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co GrConvexPolyEffect::~GrConvexPolyEffect() {} -void GrConvexPolyEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void GrConvexPolyEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const { diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h index e4749390a4..7f76f797dc 100644 --- a/src/gpu/effects/GrConvexPolyEffect.h +++ b/src/gpu/effects/GrConvexPolyEffect.h @@ -70,8 +70,6 @@ public: typedef GrGLConvexPolyEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -79,6 +77,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrPrimitiveEdgeType fEdgeType; int fEdgeCount; SkScalar fEdges[3 * kMaxEdges]; diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index f2a2d5a779..f61f378ec2 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -64,12 +64,6 @@ public: virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; - virtual void getConstantColorComponents(GrColor*, uint32_t* validFlags) const { - // If the texture was opaque we could know that the output color if we knew the sum of the - // kernel values. - *validFlags = 0; - } - enum { // This was decided based on the min allowed value for the max texture // samples per fragment program run in DX9SM2 (32). A sigma param of 4.0 @@ -103,6 +97,13 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const { + // If the texture was opaque we could know that the output color if we knew the sum of the + // kernel values. + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + GR_DECLARE_FRAGMENT_PROCESSOR_TEST; typedef Gr1DKernelEffect INHERITED; diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp index b9794c149d..7362ba98a6 100644 --- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp +++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp @@ -72,14 +72,13 @@ bool GrCustomCoordsTextureEffect::onIsEqual(const GrProcessor& other) const { return fTextureAccess == cte.fTextureAccess; } -void GrCustomCoordsTextureEffect::getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const { - if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color) && - GrPixelConfigIsOpaque(this->texture(0)->config())) { - *validFlags = kA_GrColorComponentFlag; +void GrCustomCoordsTextureEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config())) { + inout->fValidFlags = kA_GrColorComponentFlag; } else { - *validFlags = 0; + inout->fValidFlags = 0; } + inout->fIsSingleComponent = false; } const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory() const { diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.h b/src/gpu/effects/GrCustomCoordsTextureEffect.h index f48a144c56..0a6af7d4b4 100644 --- a/src/gpu/effects/GrCustomCoordsTextureEffect.h +++ b/src/gpu/effects/GrCustomCoordsTextureEffect.h @@ -28,8 +28,6 @@ public: static const char* Name() { return "Texture"; } - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } typedef GrGLCustomCoordsTextureEffect GLProcessor; @@ -41,6 +39,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrTextureAccess fTextureAccess; const GrShaderVar& fInTextureCoords; diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 704a6ac3e6..4df1f02558 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -456,8 +456,6 @@ public: typedef GLDashingCircleEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -465,6 +463,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrPrimitiveEdgeType fEdgeType; const GrShaderVar& fInCoord; SkScalar fIntervalLength; @@ -584,8 +584,9 @@ GrGeometryProcessor* DashingCircleEffect::Create(GrPrimitiveEdgeType edgeType, c DashingCircleEffect::~DashingCircleEffect() {} -void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const { @@ -668,8 +669,6 @@ public: typedef GLDashingLineEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -677,6 +676,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrPrimitiveEdgeType fEdgeType; const GrShaderVar& fInCoord; SkRect fRect; @@ -807,8 +808,9 @@ GrGeometryProcessor* DashingLineEffect::Create(GrPrimitiveEdgeType edgeType, DashingLineEffect::~DashingLineEffect() {} -void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp index d5d334805c..245a035592 100755 --- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp +++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp @@ -206,14 +206,14 @@ bool GrDistanceFieldTextureEffect::onIsEqual(const GrProcessor& other) const { fFlags == cte.fFlags; } -void GrDistanceFieldTextureEffect::getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const { - if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color) && - GrPixelConfigIsOpaque(this->texture(0)->config())) { - *validFlags = kA_GrColorComponentFlag; +void GrDistanceFieldTextureEffect::onComputeInvariantOutput( + InvariantOutput* inout) const { + if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config())) { + inout->fValidFlags = kA_GrColorComponentFlag; } else { - *validFlags = 0; + inout->fValidFlags = 0; } + inout->fIsSingleComponent = false; } const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactory() const { @@ -476,14 +476,14 @@ bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrProcessor& other) const fFlags == cte.fFlags); } -void GrDistanceFieldLCDTextureEffect::getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const { - if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color) && - GrPixelConfigIsOpaque(this->texture(0)->config())) { - *validFlags = kA_GrColorComponentFlag; +void GrDistanceFieldLCDTextureEffect::onComputeInvariantOutput( + InvariantOutput* inout) const { + if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config())) { + inout->fValidFlags = kA_GrColorComponentFlag; } else { - *validFlags = 0; + inout->fValidFlags = 0; } + inout->fIsSingleComponent = false; } const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFactory() const { diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h index b8d774d610..efd622ea72 100644 --- a/src/gpu/effects/GrDistanceFieldTextureEffect.h +++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h @@ -58,8 +58,6 @@ public: static const char* Name() { return "DistanceFieldTexture"; } - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } #ifdef SK_GAMMA_APPLY_TO_A8 float getLuminance() const { return fLuminance; } @@ -79,6 +77,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrTextureAccess fTextureAccess; #ifdef SK_GAMMA_APPLY_TO_A8 GrTextureAccess fGammaTextureAccess; @@ -112,7 +112,6 @@ public: static const char* Name() { return "DistanceFieldLCDTexture"; } const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; GrColor getTextColor() const { return fTextColor; } uint32_t getFlags() const { return fFlags; } @@ -128,6 +127,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GrTextureAccess fTextureAccess; GrTextureAccess fGammaTextureAccess; GrColor fTextColor; diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index fe7447d179..e7f90acd87 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -30,8 +30,6 @@ public: typedef GLDitherEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE { return GrTBackendFragmentProcessorFactory<DitherEffect>::getInstance(); } @@ -44,13 +42,16 @@ private: // All dither effects are equal virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GR_DECLARE_FRAGMENT_PROCESSOR_TEST; typedef GrFragmentProcessor INHERITED; }; -void DitherEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void DitherEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h index 4cc4296eee..4d76f4c9ac 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.h +++ b/src/gpu/effects/GrMatrixConvolutionEffect.h @@ -52,12 +52,6 @@ public: virtual ~GrMatrixConvolutionEffect(); - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - // TODO: Try to do better? - *validFlags = 0; - } - static const char* Name() { return "MatrixConvolution"; } const SkIRect& bounds() const { return fBounds; } const SkISize& kernelSize() const { return fKernelSize; } @@ -85,6 +79,12 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + // TODO: Try to do better? + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; + } + SkIRect fBounds; SkISize fKernelSize; float fKernel[MAX_KERNEL_SIZE]; diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 10fd8a6bf4..2a04e16611 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -32,8 +32,6 @@ public: typedef GLCircleEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -41,6 +39,8 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + SkPoint fCenter; SkScalar fRadius; GrPrimitiveEdgeType fEdgeType; @@ -56,8 +56,9 @@ GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); } -void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void CircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const { @@ -204,8 +205,6 @@ public: typedef GLEllipseEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -213,6 +212,8 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + SkPoint fCenter; SkVector fRadii; GrPrimitiveEdgeType fEdgeType; @@ -230,8 +231,9 @@ GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); } -void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void EllipseEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const { diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index f5131feba4..0af564c844 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -59,8 +59,6 @@ public: typedef GLCircularRRectEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -68,6 +66,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + SkRRect fRRect; GrPrimitiveEdgeType fEdgeType; uint32_t fCircularCornerFlags; @@ -86,8 +86,9 @@ GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect)); } -void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void CircularRRectEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const { @@ -399,8 +400,6 @@ public: typedef GLEllipticalRRectEffect GLProcessor; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; private: @@ -408,6 +407,8 @@ private: virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + SkRRect fRRect; GrPrimitiveEdgeType fEdgeType; @@ -424,8 +425,9 @@ EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); } -void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - *validFlags = 0; +void EllipticalRRectEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + inout->fValidFlags = 0; + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() const { diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 6743ddbbe1..a7707da8af 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -41,8 +41,9 @@ private: /////////////////////////////////////////////////////////////////////////////// -void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { - this->updateConstantColorComponentsForModulation(color, validFlags); +void GrSimpleTextureEffect::onComputeInvariantOutput(InvariantOutput* inout) const { + this->updateInvariantOutputForModulation(inout); + inout->fIsSingleComponent = false; } const GrBackendFragmentProcessorFactory& GrSimpleTextureEffect::getFactory() const { diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index dc9cf85e0f..88c5ca21a1 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -49,8 +49,6 @@ public: static const char* Name() { return "Texture"; } - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; - typedef GrGLSimpleTextureEffect GLProcessor; virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; @@ -75,6 +73,8 @@ private: return this->hasSameTextureParamsMatrixAndSourceCoords(ste); } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GR_DECLARE_FRAGMENT_PROCESSOR_TEST; typedef GrSingleTextureEffect INHERITED; diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index 6349ee7896..cba322eab4 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -44,16 +44,15 @@ protected: } /** - * Can be used as a helper to implement subclass getConstantColorComponents(). It assumes that + * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that * the subclass output color will be a modulation of the input color with a value read from the * texture. */ - void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* validFlags) const { - if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color) && - GrPixelConfigIsOpaque(this->texture(0)->config())) { - *validFlags = kA_GrColorComponentFlag; + void updateInvariantOutputForModulation(InvariantOutput* inout) const { + if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config())) { + inout->fValidFlags = kA_GrColorComponentFlag; } else { - *validFlags = 0; + inout->fValidFlags = 0; } } diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 1d3b37dddd..90e3b412e6 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -269,12 +269,13 @@ bool GrTextureDomainEffect::onIsEqual(const GrProcessor& sBase) const { this->fTextureDomain == s.fTextureDomain; } -void GrTextureDomainEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { +void GrTextureDomainEffect::onComputeInvariantOutput(InvariantOutput* inout) const { if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper - *validFlags = 0; + inout->fValidFlags = 0; } else { - this->updateConstantColorComponentsForModulation(color, validFlags); + this->updateInvariantOutputForModulation(inout); } + inout->fIsSingleComponent = false; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index 5751bad0f7..ec86847925 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -159,7 +159,6 @@ public: typedef GrGLTextureDomainEffect GLProcessor; virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; const GrTextureDomain& textureDomain() const { return fTextureDomain; } @@ -176,6 +175,8 @@ private: virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE; + GR_DECLARE_FRAGMENT_PROCESSOR_TEST; typedef GrSingleTextureEffect INHERITED; diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 436106c991..cdbe654ede 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -28,13 +28,6 @@ public: return GrTBackendFragmentProcessorFactory<YUVtoRGBEffect>::getInstance(); } - virtual void getConstantColorComponents(GrColor* color, - uint32_t* validFlags) const SK_OVERRIDE { - // YUV is opaque - *color = 0xFF; - *validFlags = kA_GrColorComponentFlag; - } - SkYUVColorSpace getColorSpace() const { return fColorSpace; } @@ -117,6 +110,13 @@ private: fColorSpace == s.getColorSpace(); } + virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { + // YUV is opaque + inout->fColor = 0xFF; + inout->fValidFlags = kA_GrColorComponentFlag; + inout->fIsSingleComponent = false; + } + GrCoordTransform fCoordTransform; GrTextureAccess fYAccess; GrTextureAccess fUAccess; |