OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrTypes.h" | 9 #include "GrTypes.h" |
10 #include "SkTLogic.h" | 10 #include "SkTLogic.h" |
11 #include "GrXferProcessor.h" | 11 #include "GrXferProcessor.h" |
egdaniel
2015/06/11 18:01:02
Haven't actually looked, but since you moved stuff
Chris Dalton
2015/06/11 18:06:25
You're right. Done.
| |
12 | 12 |
13 #ifndef GrBlend_DEFINED | 13 #ifndef GrBlend_DEFINED |
14 #define GrBlend_DEFINED | 14 #define GrBlend_DEFINED |
15 | 15 |
16 /** | |
17 * Equations for alpha-blending. | |
18 */ | |
19 enum GrBlendEquation { | |
20 // Basic blend equations. | |
21 kAdd_GrBlendEquation, //<! Cs*S + Cd*D | |
22 kSubtract_GrBlendEquation, //<! Cs*S - Cd*D | |
23 kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S | |
24 | |
25 // Advanced blend equations. These are described in the SVG and PDF specs. | |
26 kScreen_GrBlendEquation, | |
27 kOverlay_GrBlendEquation, | |
28 kDarken_GrBlendEquation, | |
29 kLighten_GrBlendEquation, | |
30 kColorDodge_GrBlendEquation, | |
31 kColorBurn_GrBlendEquation, | |
32 kHardLight_GrBlendEquation, | |
33 kSoftLight_GrBlendEquation, | |
34 kDifference_GrBlendEquation, | |
35 kExclusion_GrBlendEquation, | |
36 kMultiply_GrBlendEquation, | |
37 kHSLHue_GrBlendEquation, | |
38 kHSLSaturation_GrBlendEquation, | |
39 kHSLColor_GrBlendEquation, | |
40 kHSLLuminosity_GrBlendEquation, | |
41 | |
42 kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation, | |
43 kLast_GrBlendEquation = kHSLLuminosity_GrBlendEquation | |
44 }; | |
45 | |
46 static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1; | |
47 | |
48 | |
49 /** | |
50 * Coeffecients for alpha-blending. | |
51 */ | |
52 enum GrBlendCoeff { | |
53 kZero_GrBlendCoeff, //<! 0 | |
54 kOne_GrBlendCoeff, //<! 1 | |
55 kSC_GrBlendCoeff, //<! src color | |
56 kISC_GrBlendCoeff, //<! one minus src color | |
57 kDC_GrBlendCoeff, //<! dst color | |
58 kIDC_GrBlendCoeff, //<! one minus dst color | |
59 kSA_GrBlendCoeff, //<! src alpha | |
60 kISA_GrBlendCoeff, //<! one minus src alpha | |
61 kDA_GrBlendCoeff, //<! dst alpha | |
62 kIDA_GrBlendCoeff, //<! one minus dst alpha | |
63 kConstC_GrBlendCoeff, //<! constant color | |
64 kIConstC_GrBlendCoeff, //<! one minus constant color | |
65 kConstA_GrBlendCoeff, //<! constant color alpha | |
66 kIConstA_GrBlendCoeff, //<! one minus constant color alpha | |
67 kS2C_GrBlendCoeff, | |
68 kIS2C_GrBlendCoeff, | |
69 kS2A_GrBlendCoeff, | |
70 kIS2A_GrBlendCoeff, | |
71 | |
72 kLast_GrBlendCoeff = kIS2A_GrBlendCoeff | |
73 }; | |
74 | |
75 static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1; | |
76 | |
77 | |
16 template<GrBlendCoeff Coeff> | 78 template<GrBlendCoeff Coeff> |
17 struct GrTBlendCoeffRefsSrc : SkTBool<kSC_GrBlendCoeff == Coeff || | 79 struct GrTBlendCoeffRefsSrc : SkTBool<kSC_GrBlendCoeff == Coeff || |
18 kISC_GrBlendCoeff == Coeff || | 80 kISC_GrBlendCoeff == Coeff || |
19 kSA_GrBlendCoeff == Coeff || | 81 kSA_GrBlendCoeff == Coeff || |
20 kISA_GrBlendCoeff == Coeff> {}; | 82 kISA_GrBlendCoeff == Coeff> {}; |
21 | 83 |
22 #define GR_BLEND_COEFF_REFS_SRC(COEFF) \ | 84 #define GR_BLEND_COEFF_REFS_SRC(COEFF) \ |
23 GrTBlendCoeffRefsSrc<COEFF>::value | 85 GrTBlendCoeffRefsSrc<COEFF>::value |
24 | 86 |
25 inline bool GrBlendCoeffRefsSrc(GrBlendCoeff coeff) { | 87 inline bool GrBlendCoeffRefsSrc(GrBlendCoeff coeff) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 kReverseSubtract_GrBlendEqua tion == Equation) && | 208 kReverseSubtract_GrBlendEqua tion == Equation) && |
147 !GR_BLEND_COEFF_REFS_SRC(SrcC oeff) && | 209 !GR_BLEND_COEFF_REFS_SRC(SrcC oeff) && |
148 (kOne_GrBlendCoeff == DstCoef f || | 210 (kOne_GrBlendCoeff == DstCoef f || |
149 kISC_GrBlendCoeff == DstCoef f || | 211 kISC_GrBlendCoeff == DstCoef f || |
150 kISA_GrBlendCoeff == DstCoef f))> {}; | 212 kISA_GrBlendCoeff == DstCoef f))> {}; |
151 | 213 |
152 #define GR_BLEND_CAN_TWEAK_ALPHA_FOR_COVERAGE(EQUATION, SRC_COEFF, DST_COEFF) \ | 214 #define GR_BLEND_CAN_TWEAK_ALPHA_FOR_COVERAGE(EQUATION, SRC_COEFF, DST_COEFF) \ |
153 GrTBlendCanTweakAlphaForCoverage<EQUATION, SRC_COEFF, DST_COEFF>::value | 215 GrTBlendCanTweakAlphaForCoverage<EQUATION, SRC_COEFF, DST_COEFF>::value |
154 | 216 |
155 #endif | 217 #endif |
OLD | NEW |