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 "GrProcessorDataManager.h" | |
15 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 15 #include "effects/GrPorterDuffXferProcessor.h" |
17 #include "GrFragmentProcessor.h" | 16 #include "GrFragmentProcessor.h" |
18 | 17 |
19 #include "SkRegion.h" | 18 #include "SkRegion.h" |
20 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
21 | 20 |
22 /** | 21 /** |
23 * 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 |
24 * functions and the how color is blended with the destination pixel. | 23 * functions and the how color is blended with the destination pixel. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 133 } |
135 | 134 |
136 /** | 135 /** |
137 * Returns true if the paint's output color will be constant after blending.
If the result is | 136 * Returns true if the paint's output color will be constant after blending.
If the result is |
138 * true, constantColor will be updated to contain the constant color. Note t
hat we can conflate | 137 * true, constantColor will be updated to contain the constant color. Note t
hat we can conflate |
139 * coverage and color, so the actual values written to pixels with partial c
overage may still | 138 * coverage and color, so the actual values written to pixels with partial c
overage may still |
140 * not seem constant, even if this function returns true. | 139 * not seem constant, even if this function returns true. |
141 */ | 140 */ |
142 bool isConstantBlendedColor(GrColor* constantColor) const; | 141 bool isConstantBlendedColor(GrColor* constantColor) const; |
143 | 142 |
144 GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager
; } | |
145 | |
146 const GrProcessorDataManager* processorDataManager() const { return &fProcDa
taManager; } | |
147 | |
148 private: | 143 private: |
149 void resetFragmentProcessors() { | 144 void resetFragmentProcessors() { |
150 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 145 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
151 fColorFragmentProcessors[i]->unref(); | 146 fColorFragmentProcessors[i]->unref(); |
152 } | 147 } |
153 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 148 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
154 fCoverageFragmentProcessors[i]->unref(); | 149 fCoverageFragmentProcessors[i]->unref(); |
155 } | 150 } |
156 fColorFragmentProcessors.reset(); | 151 fColorFragmentProcessors.reset(); |
157 fCoverageFragmentProcessors.reset(); | 152 fCoverageFragmentProcessors.reset(); |
158 } | 153 } |
159 | 154 |
160 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 155 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
161 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; | 156 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; |
162 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; | 157 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; |
163 | 158 |
164 bool fAntiAlias; | 159 bool fAntiAlias; |
165 | 160 |
166 GrColor fColor; | 161 GrColor fColor; |
167 GrProcessorDataManager fProcDataManager; | |
168 }; | 162 }; |
169 | 163 |
170 #endif | 164 #endif |
OLD | NEW |