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 "GrFragmentStage.h" | 14 #include "GrFragmentStage.h" |
15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
17 | 17 |
| 18 #include "SkRegion.h" |
18 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
19 | 20 |
20 /** | 21 /** |
21 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw | 22 * The paint describes how color and coverage are computed at each pixel by GrCo
ntext draw |
22 * functions and the how color is blended with the destination pixel. | 23 * functions and the how color is blended with the destination pixel. |
23 * | 24 * |
24 * The paint allows installation of custom color and coverage stages. New types
of stages are | 25 * The paint allows installation of custom color and coverage stages. New types
of stages are |
25 * created by subclassing GrProcessor. | 26 * created by subclassing GrProcessor. |
26 * | 27 * |
27 * The primitive color computation starts with the color specified by setColor()
. This color is the | 28 * The primitive color computation starts with the color specified by setColor()
. This color is the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 64 |
64 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 65 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
65 fXPFactory.reset(SkRef(xpFactory)); | 66 fXPFactory.reset(SkRef(xpFactory)); |
66 return xpFactory; | 67 return xpFactory; |
67 } | 68 } |
68 | 69 |
69 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 70 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
70 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); | 71 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); |
71 } | 72 } |
72 | 73 |
73 void setPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) { | 74 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false); |
74 fXPFactory.reset(GrPorterDuffXPFactory::Create(src, dst)); | |
75 } | |
76 | 75 |
77 /** | 76 /** |
78 * Appends an additional color processor to the color computation. | 77 * Appends an additional color processor to the color computation. |
79 */ | 78 */ |
80 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp)
{ | 79 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp)
{ |
81 SkASSERT(fp); | 80 SkASSERT(fp); |
82 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (fp)); | 81 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (fp)); |
83 return fp; | 82 return fp; |
84 } | 83 } |
85 | 84 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SkSTArray<4, GrFragmentStage> fColorStages; | 139 SkSTArray<4, GrFragmentStage> fColorStages; |
141 SkSTArray<2, GrFragmentStage> fCoverageStages; | 140 SkSTArray<2, GrFragmentStage> fCoverageStages; |
142 | 141 |
143 bool fAntiAlias; | 142 bool fAntiAlias; |
144 bool fDither; | 143 bool fDither; |
145 | 144 |
146 GrColor fColor; | 145 GrColor fColor; |
147 }; | 146 }; |
148 | 147 |
149 #endif | 148 #endif |
OLD | NEW |