Index: include/gpu/GrXferProcessor.h |
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h |
index cb35201ae056c5d7b636b74920dea5fae6d0e62b..2eb773b7a244b37894a4d60b64d9a9c782b10031 100644 |
--- a/include/gpu/GrXferProcessor.h |
+++ b/include/gpu/GrXferProcessor.h |
@@ -20,6 +20,43 @@ class GrGLXferProcessor; |
class GrProcOptInfo; |
/** |
+ * Equations for alpha-blending. |
+ */ |
+enum GrBlendEquation { |
+ kInvalid_GrBlendEquation = -1, |
+ |
+ // Basic blend equations. |
+ kAdd_GrBlendEquation, //<! Cs*S + Cd*D |
+ kSubtract_GrBlendEquation, //<! Cs*S - Cd*D |
+ kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S |
+ |
+ kLastBasicGrBlendEquation = kReverseSubtract_GrBlendEquation, |
+ |
+ // Advanced blend equations. These are described in the SVG and PDF specs. |
+ kScreen_GrBlendEquation, |
+ kOverlay_GrBlendEquation, |
+ kDarken_GrBlendEquation, |
+ kLighten_GrBlendEquation, |
+ kColorDodge_GrBlendEquation, |
+ kColorBurn_GrBlendEquation, |
+ kHardLight_GrBlendEquation, |
+ kSoftLight_GrBlendEquation, |
+ kDifference_GrBlendEquation, |
+ kExclusion_GrBlendEquation, |
+ kMultiply_GrBlendEquation, |
+ kHSLHue_GrBlendEquation, |
+ kHSLSaturation_GrBlendEquation, |
+ kHSLColor_GrBlendEquation, |
+ kHSLLuminosity_GrBlendEquation, |
+ |
+ kTotalGrBlendEquationCount |
+}; |
+ |
+bool constexpr GrBlendEquationIsAdvanced(GrBlendEquation equation) { |
+ return equation > kLastBasicGrBlendEquation; |
+} |
+ |
+/** |
* Coeffecients for alpha-blending. |
*/ |
enum GrBlendCoeff { |
@@ -125,13 +162,15 @@ public: |
const GrDrawTargetCaps& caps) = 0; |
struct BlendInfo { |
- GrBlendCoeff fSrcBlend; |
- GrBlendCoeff fDstBlend; |
- GrColor fBlendConstant; |
- bool fWriteColor; |
+ GrBlendEquation fEquation; |
+ GrBlendCoeff fSrcBlend; |
+ GrBlendCoeff fDstBlend; |
+ GrColor fBlendConstant; |
+ bool fWriteColor; |
}; |
void getBlendInfo(BlendInfo* blendInfo) const { |
+ blendInfo->fEquation = kAdd_GrBlendEquation; |
blendInfo->fSrcBlend = kOne_GrBlendCoeff; |
blendInfo->fDstBlend = kZero_GrBlendCoeff; |
blendInfo->fBlendConstant = 0; |