| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 fColorFragmentProcessors = paint.fColorFragmentProcessors; | 129 fColorFragmentProcessors = paint.fColorFragmentProcessors; |
| 130 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; | 130 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; |
| 131 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 131 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
| 132 fColorFragmentProcessors[i]->ref(); | 132 fColorFragmentProcessors[i]->ref(); |
| 133 } | 133 } |
| 134 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 134 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
| 135 fCoverageFragmentProcessors[i]->ref(); | 135 fCoverageFragmentProcessors[i]->ref(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 fXPFactory.reset(SkRef(paint.getXPFactory())); | 138 fXPFactory.reset(SkRef(paint.getXPFactory())); |
| 139 fProcDataManager.reset(new GrProcessorDataManager(*paint.processorDataMa
nager())); | |
| 140 | 139 |
| 141 return *this; | 140 return *this; |
| 142 } | 141 } |
| 143 | 142 |
| 144 /** | 143 /** |
| 145 * Returns true if the paint's output color will be constant after blending.
If the result is | 144 * Returns true if the paint's output color will be constant after blending.
If the result is |
| 146 * true, constantColor will be updated to contain the constant color. Note t
hat we can conflate | 145 * true, constantColor will be updated to contain the constant color. Note t
hat we can conflate |
| 147 * coverage and color, so the actual values written to pixels with partial c
overage may still | 146 * coverage and color, so the actual values written to pixels with partial c
overage may still |
| 148 * not seem constant, even if this function returns true. | 147 * not seem constant, even if this function returns true. |
| 149 */ | 148 */ |
| 150 bool isConstantBlendedColor(GrColor* constantColor) const; | 149 bool isConstantBlendedColor(GrColor* constantColor) const; |
| 151 | 150 |
| 152 GrProcessorDataManager* getProcessorDataManager() { return fProcDataManager.
get(); } | 151 GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager
; } |
| 153 | 152 |
| 154 const GrProcessorDataManager* processorDataManager() const { return fProcDat
aManager.get(); } | 153 const GrProcessorDataManager* processorDataManager() const { return &fProcDa
taManager; } |
| 155 | 154 |
| 156 private: | 155 private: |
| 157 void resetFragmentProcessors() { | 156 void resetFragmentProcessors() { |
| 158 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 157 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
| 159 fColorFragmentProcessors[i]->unref(); | 158 fColorFragmentProcessors[i]->unref(); |
| 160 } | 159 } |
| 161 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 160 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
| 162 fCoverageFragmentProcessors[i]->unref(); | 161 fCoverageFragmentProcessors[i]->unref(); |
| 163 } | 162 } |
| 164 fColorFragmentProcessors.reset(); | 163 fColorFragmentProcessors.reset(); |
| 165 fCoverageFragmentProcessors.reset(); | 164 fCoverageFragmentProcessors.reset(); |
| 166 } | 165 } |
| 167 | 166 |
| 168 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 167 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 169 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; | 168 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; |
| 170 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; | 169 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; |
| 171 | 170 |
| 172 bool fAntiAlias; | 171 bool fAntiAlias; |
| 173 bool fDither; | 172 bool fDither; |
| 174 | 173 |
| 175 GrColor fColor; | 174 GrColor fColor; |
| 176 SkAutoTUnref<GrProcessorDataManager> fProcDataManager; | 175 GrProcessorDataManager fProcDataManager; |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 #endif | 178 #endif |
| OLD | NEW |