Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: include/gpu/GrBlend.h

Issue 1180713008: Move blend enums into GrBlend.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: relative include Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrXferProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "../../src/utils/SkTLogic.h"
mtklein 2015/06/12 15:15:45 Boy this line of code LGTM.
11 #include "GrXferProcessor.h"
12 11
13 #ifndef GrBlend_DEFINED 12 #ifndef GrBlend_DEFINED
14 #define GrBlend_DEFINED 13 #define GrBlend_DEFINED
15 14
15 /**
16 * Equations for alpha-blending.
17 */
18 enum GrBlendEquation {
19 // Basic blend equations.
20 kAdd_GrBlendEquation, //<! Cs*S + Cd*D
21 kSubtract_GrBlendEquation, //<! Cs*S - Cd*D
22 kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S
23
24 // Advanced blend equations. These are described in the SVG and PDF specs.
25 kScreen_GrBlendEquation,
26 kOverlay_GrBlendEquation,
27 kDarken_GrBlendEquation,
28 kLighten_GrBlendEquation,
29 kColorDodge_GrBlendEquation,
30 kColorBurn_GrBlendEquation,
31 kHardLight_GrBlendEquation,
32 kSoftLight_GrBlendEquation,
33 kDifference_GrBlendEquation,
34 kExclusion_GrBlendEquation,
35 kMultiply_GrBlendEquation,
36 kHSLHue_GrBlendEquation,
37 kHSLSaturation_GrBlendEquation,
38 kHSLColor_GrBlendEquation,
39 kHSLLuminosity_GrBlendEquation,
40
41 kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation,
42 kLast_GrBlendEquation = kHSLLuminosity_GrBlendEquation
43 };
44
45 static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1;
46
47
48 /**
49 * Coeffecients for alpha-blending.
50 */
51 enum GrBlendCoeff {
52 kZero_GrBlendCoeff, //<! 0
53 kOne_GrBlendCoeff, //<! 1
54 kSC_GrBlendCoeff, //<! src color
55 kISC_GrBlendCoeff, //<! one minus src color
56 kDC_GrBlendCoeff, //<! dst color
57 kIDC_GrBlendCoeff, //<! one minus dst color
58 kSA_GrBlendCoeff, //<! src alpha
59 kISA_GrBlendCoeff, //<! one minus src alpha
60 kDA_GrBlendCoeff, //<! dst alpha
61 kIDA_GrBlendCoeff, //<! one minus dst alpha
62 kConstC_GrBlendCoeff, //<! constant color
63 kIConstC_GrBlendCoeff, //<! one minus constant color
64 kConstA_GrBlendCoeff, //<! constant color alpha
65 kIConstA_GrBlendCoeff, //<! one minus constant color alpha
66 kS2C_GrBlendCoeff,
67 kIS2C_GrBlendCoeff,
68 kS2A_GrBlendCoeff,
69 kIS2A_GrBlendCoeff,
70
71 kLast_GrBlendCoeff = kIS2A_GrBlendCoeff
72 };
73
74 static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1;
75
76
16 template<GrBlendCoeff Coeff> 77 template<GrBlendCoeff Coeff>
17 struct GrTBlendCoeffRefsSrc : SkTBool<kSC_GrBlendCoeff == Coeff || 78 struct GrTBlendCoeffRefsSrc : SkTBool<kSC_GrBlendCoeff == Coeff ||
18 kISC_GrBlendCoeff == Coeff || 79 kISC_GrBlendCoeff == Coeff ||
19 kSA_GrBlendCoeff == Coeff || 80 kSA_GrBlendCoeff == Coeff ||
20 kISA_GrBlendCoeff == Coeff> {}; 81 kISA_GrBlendCoeff == Coeff> {};
21 82
22 #define GR_BLEND_COEFF_REFS_SRC(COEFF) \ 83 #define GR_BLEND_COEFF_REFS_SRC(COEFF) \
23 GrTBlendCoeffRefsSrc<COEFF>::value 84 GrTBlendCoeffRefsSrc<COEFF>::value
24 85
25 inline bool GrBlendCoeffRefsSrc(GrBlendCoeff coeff) { 86 inline bool GrBlendCoeffRefsSrc(GrBlendCoeff coeff) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 kReverseSubtract_GrBlendEqua tion == Equation) && 207 kReverseSubtract_GrBlendEqua tion == Equation) &&
147 !GR_BLEND_COEFF_REFS_SRC(SrcC oeff) && 208 !GR_BLEND_COEFF_REFS_SRC(SrcC oeff) &&
148 (kOne_GrBlendCoeff == DstCoef f || 209 (kOne_GrBlendCoeff == DstCoef f ||
149 kISC_GrBlendCoeff == DstCoef f || 210 kISC_GrBlendCoeff == DstCoef f ||
150 kISA_GrBlendCoeff == DstCoef f))> {}; 211 kISA_GrBlendCoeff == DstCoef f))> {};
151 212
152 #define GR_BLEND_CAN_TWEAK_ALPHA_FOR_COVERAGE(EQUATION, SRC_COEFF, DST_COEFF) \ 213 #define GR_BLEND_CAN_TWEAK_ALPHA_FOR_COVERAGE(EQUATION, SRC_COEFF, DST_COEFF) \
153 GrTBlendCanTweakAlphaForCoverage<EQUATION, SRC_COEFF, DST_COEFF>::value 214 GrTBlendCanTweakAlphaForCoverage<EQUATION, SRC_COEFF, DST_COEFF>::value
154 215
155 #endif 216 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698