OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
10 | 10 |
| 11 #include "GrBlend.h" |
11 #include "GrColor.h" | 12 #include "GrColor.h" |
12 #include "GrProcessor.h" | 13 #include "GrProcessor.h" |
13 #include "GrTexture.h" | 14 #include "GrTexture.h" |
14 #include "GrTypes.h" | 15 #include "GrTypes.h" |
15 #include "SkXfermode.h" | 16 #include "SkXfermode.h" |
16 | 17 |
17 class GrShaderCaps; | 18 class GrShaderCaps; |
18 class GrGLSLCaps; | 19 class GrGLSLCaps; |
19 class GrGLXferProcessor; | 20 class GrGLXferProcessor; |
20 class GrProcOptInfo; | 21 class GrProcOptInfo; |
21 | 22 |
22 /** | 23 /** |
23 * Equations for alpha-blending. | |
24 */ | |
25 enum GrBlendEquation { | |
26 // Basic blend equations. | |
27 kAdd_GrBlendEquation, //<! Cs*S + Cd*D | |
28 kSubtract_GrBlendEquation, //<! Cs*S - Cd*D | |
29 kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S | |
30 | |
31 // Advanced blend equations. These are described in the SVG and PDF specs. | |
32 kScreen_GrBlendEquation, | |
33 kOverlay_GrBlendEquation, | |
34 kDarken_GrBlendEquation, | |
35 kLighten_GrBlendEquation, | |
36 kColorDodge_GrBlendEquation, | |
37 kColorBurn_GrBlendEquation, | |
38 kHardLight_GrBlendEquation, | |
39 kSoftLight_GrBlendEquation, | |
40 kDifference_GrBlendEquation, | |
41 kExclusion_GrBlendEquation, | |
42 kMultiply_GrBlendEquation, | |
43 kHSLHue_GrBlendEquation, | |
44 kHSLSaturation_GrBlendEquation, | |
45 kHSLColor_GrBlendEquation, | |
46 kHSLLuminosity_GrBlendEquation, | |
47 | |
48 kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation, | |
49 kLast_GrBlendEquation = kHSLLuminosity_GrBlendEquation | |
50 }; | |
51 | |
52 static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1; | |
53 | |
54 /** | |
55 * Coeffecients for alpha-blending. | |
56 */ | |
57 enum GrBlendCoeff { | |
58 kZero_GrBlendCoeff, //<! 0 | |
59 kOne_GrBlendCoeff, //<! 1 | |
60 kSC_GrBlendCoeff, //<! src color | |
61 kISC_GrBlendCoeff, //<! one minus src color | |
62 kDC_GrBlendCoeff, //<! dst color | |
63 kIDC_GrBlendCoeff, //<! one minus dst color | |
64 kSA_GrBlendCoeff, //<! src alpha | |
65 kISA_GrBlendCoeff, //<! one minus src alpha | |
66 kDA_GrBlendCoeff, //<! dst alpha | |
67 kIDA_GrBlendCoeff, //<! one minus dst alpha | |
68 kConstC_GrBlendCoeff, //<! constant color | |
69 kIConstC_GrBlendCoeff, //<! one minus constant color | |
70 kConstA_GrBlendCoeff, //<! constant color alpha | |
71 kIConstA_GrBlendCoeff, //<! one minus constant color alpha | |
72 kS2C_GrBlendCoeff, | |
73 kIS2C_GrBlendCoeff, | |
74 kS2A_GrBlendCoeff, | |
75 kIS2A_GrBlendCoeff, | |
76 | |
77 kLast_GrBlendCoeff = kIS2A_GrBlendCoeff | |
78 }; | |
79 | |
80 static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1; | |
81 | |
82 /** | |
83 * Barriers for blending. When a shader reads the dst directly, an Xfer barrier
is sometimes | 24 * Barriers for blending. When a shader reads the dst directly, an Xfer barrier
is sometimes |
84 * required after a pixel has been written, before it can be safely read again. | 25 * required after a pixel has been written, before it can be safely read again. |
85 */ | 26 */ |
86 enum GrXferBarrierType { | 27 enum GrXferBarrierType { |
87 kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to
the same texture. | 28 kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to
the same texture. |
88 kBlend_GrXferBarrierType, //<! Required by certain blend extensions. | 29 kBlend_GrXferBarrierType, //<! Required by certain blend extensions. |
89 }; | 30 }; |
90 | 31 |
91 /** | 32 /** |
92 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst | 33 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 enum { | 400 enum { |
460 kIllegalXPFClassID = 0, | 401 kIllegalXPFClassID = 0, |
461 }; | 402 }; |
462 static int32_t gCurrXPFClassID; | 403 static int32_t gCurrXPFClassID; |
463 | 404 |
464 typedef GrProgramElement INHERITED; | 405 typedef GrProgramElement INHERITED; |
465 }; | 406 }; |
466 | 407 |
467 #endif | 408 #endif |
468 | 409 |
OLD | NEW |