OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
11 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
14 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
15 | 15 |
16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
17 const GrPrimitiveProcessor* primProc, | 17 const GrPrimitiveProcessor* primProc, |
18 const GrDrawTargetCaps& caps, | 18 const GrDrawTargetCaps& caps, |
19 const GrScissorState& scissorState, | 19 const GrScissorState& scissorState, |
20 const GrDeviceCoordTexture* dstCopy, | 20 const GrDeviceCoordTexture* dstCopy) { |
21 GrGpu::DrawType drawType) { | |
22 fDrawType = drawType; | |
23 | |
24 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc); | 21 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc); |
25 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc); | 22 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc); |
26 | 23 |
27 // Create XferProcessor from DS's XPFactory | 24 // Create XferProcessor from DS's XPFactory |
28 SkAutoTUnref<GrXferProcessor> xferProcessor( | 25 SkAutoTUnref<GrXferProcessor> xferProcessor( |
29 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); | 26 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); |
30 | 27 |
31 GrColor overrideColor = GrColor_ILLEGAL; | 28 GrColor overrideColor = GrColor_ILLEGAL; |
32 if (colorPOI.firstEffectiveStageIndex() != 0) { | 29 if (colorPOI.firstEffectiveStageIndex() != 0) { |
33 overrideColor = colorPOI.inputColorToEffectiveStage(); | 30 overrideColor = colorPOI.inputColorToEffectiveStage(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 135 } |
139 } | 136 } |
140 | 137 |
141 //////////////////////////////////////////////////////////////////////////////// | 138 //////////////////////////////////////////////////////////////////////////////// |
142 | 139 |
143 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { | 140 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { |
144 if (this->getRenderTarget() != that.getRenderTarget() || | 141 if (this->getRenderTarget() != that.getRenderTarget() || |
145 this->fFragmentStages.count() != that.fFragmentStages.count() || | 142 this->fFragmentStages.count() != that.fFragmentStages.count() || |
146 this->fNumColorStages != that.fNumColorStages || | 143 this->fNumColorStages != that.fNumColorStages || |
147 this->fScissorState != that.fScissorState || | 144 this->fScissorState != that.fScissorState || |
148 this->fDrawType != that.fDrawType || | |
149 this->fFlags != that.fFlags || | 145 this->fFlags != that.fFlags || |
150 this->fStencilSettings != that.fStencilSettings || | 146 this->fStencilSettings != that.fStencilSettings || |
151 this->fDrawFace != that.fDrawFace || | 147 this->fDrawFace != that.fDrawFace || |
152 this->fDstCopy.texture() != that.fDstCopy.texture()) { | 148 this->fDstCopy.texture() != that.fDstCopy.texture()) { |
153 return false; | 149 return false; |
154 } | 150 } |
155 | 151 |
156 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { | 152 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { |
157 return false; | 153 return false; |
158 } | 154 } |
159 | 155 |
160 // The program desc comparison should have already assured that the stage co
unts match. | 156 // The program desc comparison should have already assured that the stage co
unts match. |
161 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 157 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
162 for (int i = 0; i < this->numFragmentStages(); i++) { | 158 for (int i = 0; i < this->numFragmentStages(); i++) { |
163 | 159 |
164 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 160 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
165 return false; | 161 return false; |
166 } | 162 } |
167 } | 163 } |
168 return true; | 164 return true; |
169 } | 165 } |
170 | 166 |
OLD | NEW |