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 GrPipeline_DEFINED | 8 #ifndef GrPipeline_DEFINED |
9 #define GrPipeline_DEFINED | 9 #define GrPipeline_DEFINED |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Make the renderTarget's drawTarget (if it exists) be dependent on any | 96 // Make the renderTarget's drawTarget (if it exists) be dependent on any |
97 // drawTargets in this pipeline | 97 // drawTargets in this pipeline |
98 void addDependenciesTo(GrRenderTarget* rt) const; | 98 void addDependenciesTo(GrRenderTarget* rt) const; |
99 | 99 |
100 int numColorFragmentProcessors() const { return fNumColorProcessors; } | 100 int numColorFragmentProcessors() const { return fNumColorProcessors; } |
101 int numCoverageFragmentProcessors() const { | 101 int numCoverageFragmentProcessors() const { |
102 return fFragmentProcessors.count() - fNumColorProcessors; | 102 return fFragmentProcessors.count() - fNumColorProcessors; |
103 } | 103 } |
104 int numFragmentProcessors() const { return fFragmentProcessors.count(); } | 104 int numFragmentProcessors() const { return fFragmentProcessors.count(); } |
105 | 105 |
106 const GrXferProcessor* getXferProcessor() const { return fXferProcessor.get(
); } | 106 const GrXferProcessor& getXferProcessor() const { |
| 107 if (fXferProcessor.get()) { |
| 108 return *fXferProcessor.get(); |
| 109 } else { |
| 110 // A null xp member means the common src-over case. GrXferProcessor'
s ref'ing |
| 111 // mechanism is not thread safe so we do not hold a ref on this glob
al. |
| 112 return GrPorterDuffXPFactory::SimpleSrcOverXP(); |
| 113 } |
| 114 } |
107 | 115 |
108 const GrFragmentProcessor& getColorFragmentProcessor(int idx) const { | 116 const GrFragmentProcessor& getColorFragmentProcessor(int idx) const { |
109 SkASSERT(idx < this->numColorFragmentProcessors()); | 117 SkASSERT(idx < this->numColorFragmentProcessors()); |
110 return *fFragmentProcessors[idx].get(); | 118 return *fFragmentProcessors[idx].get(); |
111 } | 119 } |
112 | 120 |
113 const GrFragmentProcessor& getCoverageFragmentProcessor(int idx) const { | 121 const GrFragmentProcessor& getCoverageFragmentProcessor(int idx) const { |
114 SkASSERT(idx < this->numCoverageFragmentProcessors()); | 122 SkASSERT(idx < this->numCoverageFragmentProcessors()); |
115 return *fFragmentProcessors[fNumColorProcessors + idx].get(); | 123 return *fFragmentProcessors[fNumColorProcessors + idx].get(); |
116 } | 124 } |
(...skipping 12 matching lines...) Expand all Loading... |
129 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } | 137 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } |
130 | 138 |
131 const GrStencilSettings& getStencil() const { return fStencilSettings; } | 139 const GrStencilSettings& getStencil() const { return fStencilSettings; } |
132 | 140 |
133 const GrScissorState& getScissorState() const { return fScissorState; } | 141 const GrScissorState& getScissorState() const { return fScissorState; } |
134 | 142 |
135 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } | 143 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
136 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } | 144 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } |
137 | 145 |
138 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { | 146 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { |
139 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps); | 147 return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), cap
s); |
140 } | 148 } |
141 | 149 |
142 /** | 150 /** |
143 * Gets whether the target is drawing clockwise, counterclockwise, | 151 * Gets whether the target is drawing clockwise, counterclockwise, |
144 * or both faces. | 152 * or both faces. |
145 * @return the current draw face(s). | 153 * @return the current draw face(s). |
146 */ | 154 */ |
147 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } | 155 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } |
148 | 156 |
149 | 157 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 bool fReadsFragPosition; | 200 bool fReadsFragPosition; |
193 bool fIgnoresCoverage; | 201 bool fIgnoresCoverage; |
194 | 202 |
195 // This value is also the index in fFragmentProcessors where coverage proces
sors begin. | 203 // This value is also the index in fFragmentProcessors where coverage proces
sors begin. |
196 int fNumColorProcessors; | 204 int fNumColorProcessors; |
197 | 205 |
198 typedef SkRefCnt INHERITED; | 206 typedef SkRefCnt INHERITED; |
199 }; | 207 }; |
200 | 208 |
201 #endif | 209 #endif |
OLD | NEW |