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 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 * Should dithering be applied. Defaults to false. | 82 * Should dithering be applied. Defaults to false. |
83 */ | 83 */ |
84 void setDither(bool dither) { fDither = dither; } | 84 void setDither(bool dither) { fDither = dither; } |
85 bool isDither() const { return fDither; } | 85 bool isDither() const { return fDither; } |
86 | 86 |
87 /** | 87 /** |
88 * Appends an additional color processor to the color computation. | 88 * Appends an additional color processor to the color computation. |
89 */ | 89 */ |
90 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp)
{ | 90 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp)
{ |
91 SkASSERT(fp); | 91 SkASSERT(fp); |
92 if (!fp->willUseInputColor()) { | |
93 fColorStages.reset(); | |
94 } | |
95 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (fp)); | 92 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (fp)); |
96 return fp; | 93 return fp; |
97 } | 94 } |
98 | 95 |
99 /** | 96 /** |
100 * Appends an additional coverage processor to the coverage computation. | 97 * Appends an additional coverage processor to the coverage computation. |
101 */ | 98 */ |
102 const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* f
p) { | 99 const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* f
p) { |
103 SkASSERT(fp); | 100 SkASSERT(fp); |
104 if (!fp->willUseInputColor()) { | |
105 fCoverageStages.reset(); | |
106 } | |
107 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (fp)); | 101 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (fp)); |
108 return fp; | 102 return fp; |
109 } | 103 } |
110 | 104 |
111 /** | 105 /** |
112 * Helpers for adding color or coverage effects that sample a texture. The m
atrix is applied | 106 * Helpers for adding color or coverage effects that sample a texture. The m
atrix is applied |
113 * to the src space position to compute texture coordinates. | 107 * to the src space position to compute texture coordinates. |
114 */ | 108 */ |
115 void addColorTextureProcessor(GrTexture*, const SkMatrix&); | 109 void addColorTextureProcessor(GrTexture*, const SkMatrix&); |
116 void addCoverageTextureProcessor(GrTexture*, const SkMatrix&); | 110 void addCoverageTextureProcessor(GrTexture*, const SkMatrix&); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 fCoverage = 0xff; | 234 fCoverage = 0xff; |
241 } | 235 } |
242 | 236 |
243 void resetStages() { | 237 void resetStages() { |
244 fColorStages.reset(); | 238 fColorStages.reset(); |
245 fCoverageStages.reset(); | 239 fCoverageStages.reset(); |
246 } | 240 } |
247 }; | 241 }; |
248 | 242 |
249 #endif | 243 #endif |
OLD | NEW |