OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPipelineBuilder_DEFINED | 8 #ifndef GrPipelineBuilder_DEFINED |
9 #define GrPipelineBuilder_DEFINED | 9 #define GrPipelineBuilder_DEFINED |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 /////////////////////////////////////////////////////////////////////////// | 144 /////////////////////////////////////////////////////////////////////////// |
145 /// @name Blending | 145 /// @name Blending |
146 //// | 146 //// |
147 | 147 |
148 /** | 148 /** |
149 * Installs a GrXPFactory. This object controls how src color, fractional pi
xel coverage, | 149 * Installs a GrXPFactory. This object controls how src color, fractional pi
xel coverage, |
150 * and the dst color are blended. | 150 * and the dst color are blended. |
151 */ | 151 */ |
152 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 152 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
153 fXPFactory.reset(SkRef(xpFactory)); | 153 fXPFactory.reset(SkSafeRef(xpFactory)); |
154 return xpFactory; | 154 return xpFactory; |
155 } | 155 } |
156 | 156 |
157 /** | 157 /** |
158 * Sets a GrXPFactory that will ignore src color and perform a set operation
between the draws | 158 * Sets a GrXPFactory that will ignore src color and perform a set operation
between the draws |
159 * output coverage and the destination. This is useful to render coverage ma
sks as CSG. | 159 * output coverage and the destination. This is useful to render coverage ma
sks as CSG. |
160 */ | 160 */ |
161 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false) { | 161 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false) { |
162 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCovera
ge)); | 162 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCovera
ge)); |
163 } | 163 } |
164 | 164 |
165 /** | 165 /** |
166 * Sets a GrXPFactory that disables color writes to the destination. This is
useful when | 166 * Sets a GrXPFactory that disables color writes to the destination. This is
useful when |
167 * rendering to the stencil buffer. | 167 * rendering to the stencil buffer. |
168 */ | 168 */ |
169 void setDisableColorXPFactory() { | 169 void setDisableColorXPFactory() { |
170 fXPFactory.reset(GrDisableColorXPFactory::Create()); | 170 fXPFactory.reset(GrDisableColorXPFactory::Create()); |
171 } | 171 } |
172 | 172 |
173 const GrXPFactory* getXPFactory() const { | 173 const GrXPFactory* getXPFactory() const { |
174 if (!fXPFactory) { | 174 return fXPFactory; |
175 fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode
)); | |
176 } | |
177 return fXPFactory.get(); | |
178 } | 175 } |
179 | 176 |
180 /** | 177 /** |
181 * Checks whether the xp will need destination in a texture to correctly ble
nd. | 178 * Checks whether the xp will need destination in a texture to correctly ble
nd. |
182 */ | 179 */ |
183 bool willXPNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI, | 180 bool willXPNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI, |
184 const GrProcOptInfo& coveragePOI) const; | 181 const GrProcOptInfo& coveragePOI) const; |
185 | 182 |
186 /// @} | 183 /// @} |
187 | 184 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 FragmentProcessorArray fCoverageFragmentProcessors; | 402 FragmentProcessorArray fCoverageFragmentProcessors; |
406 GrClip fClip; | 403 GrClip fClip; |
407 | 404 |
408 mutable GrProcOptInfo fColorProcInfo; | 405 mutable GrProcOptInfo fColorProcInfo; |
409 mutable GrProcOptInfo fCoverageProcInfo; | 406 mutable GrProcOptInfo fCoverageProcInfo; |
410 | 407 |
411 friend class GrPipeline; | 408 friend class GrPipeline; |
412 }; | 409 }; |
413 | 410 |
414 #endif | 411 #endif |
OLD | NEW |