OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
10 #ifndef GrPaint_DEFINED | 10 #ifndef GrPaint_DEFINED |
11 #define GrPaint_DEFINED | 11 #define GrPaint_DEFINED |
12 | 12 |
13 #include "GrColor.h" | 13 #include "GrColor.h" |
14 #include "GrColorSpaceXform.h" | 14 #include "GrColorSpaceXform.h" |
15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
17 #include "GrFragmentProcessor.h" | 17 #include "GrFragmentProcessor.h" |
18 | 18 |
| 19 #include "SkBlendMode.h" |
19 #include "SkRefCnt.h" | 20 #include "SkRefCnt.h" |
20 #include "SkRegion.h" | 21 #include "SkRegion.h" |
21 #include "SkXfermode.h" | |
22 | 22 |
23 /** | 23 /** |
24 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw | 24 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw |
25 * functions and the how color is blended with the destination pixel. | 25 * functions and the how color is blended with the destination pixel. |
26 * | 26 * |
27 * The paint allows installation of custom color and coverage stages. New types
of stages are | 27 * The paint allows installation of custom color and coverage stages. New types
of stages are |
28 * created by subclassing GrProcessor. | 28 * created by subclassing GrProcessor. |
29 * | 29 * |
30 * The primitive color computation starts with the color specified by setColor()
. This color is the | 30 * The primitive color computation starts with the color specified by setColor()
. This color is the |
31 * input to the first color stage. Each color stage feeds its output to the next
color stage. | 31 * input to the first color stage. Each color stage feeds its output to the next
color stage. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 */ | 88 */ |
89 void setGammaCorrect(bool gammaCorrect) { | 89 void setGammaCorrect(bool gammaCorrect) { |
90 setDisableOutputConversionToSRGB(!gammaCorrect); | 90 setDisableOutputConversionToSRGB(!gammaCorrect); |
91 setAllowSRGBInputs(gammaCorrect); | 91 setAllowSRGBInputs(gammaCorrect); |
92 } | 92 } |
93 | 93 |
94 void setXPFactory(sk_sp<GrXPFactory> xpFactory) { | 94 void setXPFactory(sk_sp<GrXPFactory> xpFactory) { |
95 fXPFactory = std::move(xpFactory); | 95 fXPFactory = std::move(xpFactory); |
96 } | 96 } |
97 | 97 |
| 98 void setPorterDuffXPFactory(SkBlendMode mode) { |
| 99 fXPFactory = GrPorterDuffXPFactory::Make((SkXfermode::Mode)mode); |
| 100 } |
| 101 |
98 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 102 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
99 fXPFactory = GrPorterDuffXPFactory::Make(mode); | 103 fXPFactory = GrPorterDuffXPFactory::Make(mode); |
100 } | 104 } |
101 | 105 |
102 void setCoverageSetOpXPFactory(SkRegion::Op, bool invertCoverage = false); | 106 void setCoverageSetOpXPFactory(SkRegion::Op, bool invertCoverage = false); |
103 | 107 |
104 /** | 108 /** |
105 * Appends an additional color processor to the color computation. | 109 * Appends an additional color processor to the color computation. |
106 */ | 110 */ |
107 void addColorFragmentProcessor(sk_sp<GrFragmentProcessor> fp) { | 111 void addColorFragmentProcessor(sk_sp<GrFragmentProcessor> fp) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 191 |
188 bool fAntiAlias; | 192 bool fAntiAlias; |
189 bool fDisableOutputConversionToSRGB; | 193 bool fDisableOutputConversionToSRGB; |
190 bool fAllowSRGBInputs; | 194 bool fAllowSRGBInputs; |
191 bool fUsesDistanceVectorField; | 195 bool fUsesDistanceVectorField; |
192 | 196 |
193 GrColor4f fColor; | 197 GrColor4f fColor; |
194 }; | 198 }; |
195 | 199 |
196 #endif | 200 #endif |
OLD | NEW |