Chromium Code Reviews| Index: src/gpu/GrDrawState.h |
| diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h |
| index 39163ff5eed75f787b70f498d3dc0b76f8c6ecb9..bd7fdbf764d236742c69322bab77e6268b5cd240 100644 |
| --- a/src/gpu/GrDrawState.h |
| +++ b/src/gpu/GrDrawState.h |
| @@ -93,70 +93,18 @@ public: |
| * intends to specify fractional pixel coverage (via setCoverage(), through a coverage vertex |
| * attribute, or a coverage effect) but may not have specified it yet. |
| */ |
| - bool couldApplyCoverage(const GrDrawTargetCaps& caps) const; |
| + bool couldApplyCoverage(GrColor color, GrColor coverage, const GrDrawTargetCaps& caps) const; |
|
bsalomon
2014/12/08 19:42:13
Do we really need the coverage field here? If some
joshualitt
2014/12/08 20:19:20
So, this function is called in context before we h
bsalomon
2014/12/08 20:28:15
Right that's why I think we should rephrase the qu
|
| /** |
| * Determines whether the output coverage is guaranteed to be one for all pixels hit by a draw. |
| */ |
| - bool hasSolidCoverage() const; |
| + bool hasSolidCoverage(GrColor coverage) const; |
|
bsalomon
2014/12/08 19:42:13
I assume this goes away when the GP outputs an inv
joshualitt
2014/12/08 20:19:20
I think so yes
|
| /** |
| * This function returns true if the render target destination pixel values will be read for |
| * blending during draw. |
| */ |
| - bool willBlendWithDst() const; |
| - |
| - /// @} |
| - |
| - /////////////////////////////////////////////////////////////////////////// |
| - /// @name Color |
| - //// |
| - |
| - GrColor getColor() const { return fColor; } |
| - |
| - /** |
| - * Sets color for next draw to a premultiplied-alpha color. |
| - * |
| - * @param color the color to set. |
| - */ |
| - void setColor(GrColor color) { |
| - if (color != fColor) { |
| - fColor = color; |
| - fColorProcInfoValid = false; |
| - } |
| - } |
| - |
| - /** |
| - * Sets the color to be used for the next draw to be |
| - * (r,g,b,a) = (alpha, alpha, alpha, alpha). |
| - * |
| - * @param alpha The alpha value to set as the color. |
| - */ |
| - void setAlpha(uint8_t a) { this->setColor((a << 24) | (a << 16) | (a << 8) | a); } |
| - |
| - /// @} |
| - |
| - /////////////////////////////////////////////////////////////////////////// |
| - /// @name Coverage |
| - //// |
| - |
| - uint8_t getCoverage() const { return fCoverage; } |
| - |
| - GrColor getCoverageColor() const { |
| - return GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); |
| - } |
| - |
| - /** |
| - * Sets a constant fractional coverage to be applied to the draw. The |
| - * initial value (after construction or reset()) is 0xff. The constant |
| - * coverage is ignored when per-vertex coverage is provided. |
| - */ |
| - void setCoverage(uint8_t coverage) { |
| - if (coverage != fCoverage) { |
| - fCoverage = coverage; |
| - fCoverageProcInfoValid = false; |
| - } |
| - } |
| + bool willBlendWithDst(GrColor color, GrColor coverage) const; |
| /// @} |
| @@ -212,7 +160,7 @@ public: |
| /** |
| * Checks whether any of the effects will read the dst pixel color. |
| */ |
| - bool willEffectReadDstColor() const; |
| + bool willEffectReadDstColor(GrColor color, GrColor coverage) const; |
|
bsalomon
2014/12/08 19:42:13
Add a TODO to remove this function once only XP ca
joshualitt
2014/12/08 20:19:20
Acknowledged.
|
| const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effect) { |
| SkASSERT(effect); |
| @@ -674,36 +622,38 @@ private: |
| * |
| * This is used internally and when constructing a GrOptDrawState. |
| */ |
| - BlendOpt getBlendOpt(bool forceCoverage = false, |
| + BlendOpt getBlendOpt(GrColor color, |
| + GrColor coverage, |
| + bool forceCoverage = false, |
| GrBlendCoeff* srcCoeff = NULL, |
| GrBlendCoeff* dstCoeff = NULL) const; |
| - const GrProcOptInfo& colorProcInfo() const { |
| - this->calcColorInvariantOutput(); |
| + const GrProcOptInfo& colorProcInfo(GrColor color) const { |
| + this->calcColorInvariantOutput(color); |
| return fColorProcInfo; |
| } |
| - const GrProcOptInfo& coverageProcInfo() const { |
| - this->calcCoverageInvariantOutput(); |
| + const GrProcOptInfo& coverageProcInfo(GrColor coverage) const { |
| + this->calcCoverageInvariantOutput(coverage); |
| return fCoverageProcInfo; |
| } |
| /** |
| * Determines whether src alpha is guaranteed to be one for all src pixels |
| */ |
| - bool srcAlphaWillBeOne() const; |
| + bool srcAlphaWillBeOne(GrColor color, GrColor coverage) const; |
| /** |
| * If fColorProcInfoValid is false, function calculates the invariant output for the color |
| * stages and results are stored in fColorProcInfo. |
| */ |
| - void calcColorInvariantOutput() const; |
| + void calcColorInvariantOutput(GrColor) const; |
| /** |
| * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage |
| * stages and results are stored in fCoverageProcInfo. |
| */ |
| - void calcCoverageInvariantOutput() const; |
| + void calcCoverageInvariantOutput(GrColor) const; |
| void onReset(const SkMatrix* initialViewMatrix); |
| @@ -714,12 +664,10 @@ private: |
| typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; |
| SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| - GrColor fColor; |
| SkMatrix fViewMatrix; |
| GrColor fBlendConstant; |
| uint32_t fFlagBits; |
| GrStencilSettings fStencilSettings; |
| - uint8_t fCoverage; |
| DrawFace fDrawFace; |
| GrBlendCoeff fSrcBlend; |
| GrBlendCoeff fDstBlend; |
| @@ -733,6 +681,8 @@ private: |
| mutable GrProcOptInfo fCoverageProcInfo; |
| mutable bool fColorProcInfoValid; |
| mutable bool fCoverageProcInfoValid; |
| + mutable GrColor fColorCache; |
| + mutable GrColor fCoverageCache; |
| friend class GrOptDrawState; |
| }; |