Chromium Code Reviews| Index: include/gpu/GrXferProcessor.h |
| diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h |
| index 87663b1a1f92093fd098ab8898d0730fa5319e2a..12042d3f74617beca61710e19f1a75bccdf18aa7 100644 |
| --- a/include/gpu/GrXferProcessor.h |
| +++ b/include/gpu/GrXferProcessor.h |
| @@ -125,15 +125,19 @@ public: |
| const GrDrawTargetCaps& caps) = 0; |
| struct BlendInfo { |
| - BlendInfo() : fWriteColor(true) {} |
| - |
| GrBlendCoeff fSrcBlend; |
| GrBlendCoeff fDstBlend; |
| GrColor fBlendConstant; |
| bool fWriteColor; |
| }; |
| - virtual void getBlendInfo(BlendInfo* blendInfo) const = 0; |
| + void getBlendInfo(BlendInfo* blendInfo) const { |
| + blendInfo->fSrcBlend = kOne_GrBlendCoeff; |
|
bsalomon
2015/04/22 13:42:56
My only suggestion is to move this code into a res
|
| + blendInfo->fDstBlend = kZero_GrBlendCoeff; |
| + blendInfo->fBlendConstant = 0; |
| + blendInfo->fWriteColor = true; |
| + this->onGetBlendInfo(blendInfo); |
| + } |
| bool willReadDstColor() const { return fWillReadDstColor; } |
| @@ -194,6 +198,13 @@ private: |
| virtual void onGetGLProcessorKey(const GrGLCaps& caps, |
| GrProcessorKeyBuilder* b) const = 0; |
| + /** |
| + * Retrieves the hardware blend state required by this Xfer processor. The BlendInfo struct |
| + * comes initialized to default values, so the Xfer processor only needs to set the state it |
| + * needs. It may not even need to override this method at all. |
| + */ |
| + virtual void onGetBlendInfo(BlendInfo*) const {} |
| + |
| virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
| bool fWillReadDstColor; |