| 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 "GrBatch.h" |
| 10 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
| 11 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
| 12 #include "GrGpu.h" | 13 #include "GrGpu.h" |
| 13 #include "GrProcOptInfo.h" | 14 #include "GrProcOptInfo.h" |
| 14 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
| 15 | 16 |
| 16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 17 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
| 17 const GrPrimitiveProcessor* primProc, | 18 const GrPrimitiveProcessor* primProc, |
| 18 const GrDrawTargetCaps& caps, | 19 const GrDrawTargetCaps& caps, |
| 19 const GrScissorState& scissorState, | 20 const GrScissorState& scissorState, |
| 20 const GrDeviceCoordTexture* dstCopy) { | 21 const GrDeviceCoordTexture* dstCopy) { |
| 21 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc); | 22 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc); |
| 22 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc); | 23 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc); |
| 23 | 24 |
| 25 this->internalConstructor(drawState, colorPOI, coveragePOI, caps, scissorSta
te, dstCopy); |
| 26 } |
| 27 |
| 28 GrOptDrawState::GrOptDrawState(GrBatch* batch, |
| 29 const GrDrawState& drawState, |
| 30 const GrDrawTargetCaps& caps, |
| 31 const GrScissorState& scissorState, |
| 32 const GrDeviceCoordTexture* dstCopy) { |
| 33 GrBatchOpt batchOpt; |
| 34 batchOpt.fCanTweakAlphaForCoverage = drawState.canTweakAlphaForCoverage(); |
| 35 batch->initBatchOpt(batchOpt); |
| 36 |
| 37 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(batch); |
| 38 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(batch); |
| 39 |
| 40 this->internalConstructor(drawState, colorPOI, coveragePOI, caps, scissorSta
te, dstCopy); |
| 41 } |
| 42 |
| 43 void GrOptDrawState::internalConstructor(const GrDrawState& drawState, |
| 44 const GrProcOptInfo& colorPOI, |
| 45 const GrProcOptInfo& coveragePOI, |
| 46 const GrDrawTargetCaps& caps, |
| 47 const GrScissorState& scissorState, |
| 48 const GrDeviceCoordTexture* dstCopy) { |
| 24 // Create XferProcessor from DS's XPFactory | 49 // Create XferProcessor from DS's XPFactory |
| 25 SkAutoTUnref<GrXferProcessor> xferProcessor( | 50 SkAutoTUnref<GrXferProcessor> xferProcessor( |
| 26 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); | 51 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); |
| 27 | 52 |
| 28 GrColor overrideColor = GrColor_ILLEGAL; | 53 GrColor overrideColor = GrColor_ILLEGAL; |
| 29 if (colorPOI.firstEffectiveStageIndex() != 0) { | 54 if (colorPOI.firstEffectiveStageIndex() != 0) { |
| 30 overrideColor = colorPOI.inputColorToEffectiveStage(); | 55 overrideColor = colorPOI.inputColorToEffectiveStage(); |
| 31 } | 56 } |
| 32 | 57 |
| 33 GrXferProcessor::OptFlags optFlags; | 58 GrXferProcessor::OptFlags optFlags; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 182 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
| 158 for (int i = 0; i < this->numFragmentStages(); i++) { | 183 for (int i = 0; i < this->numFragmentStages(); i++) { |
| 159 | 184 |
| 160 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 185 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 161 return false; | 186 return false; |
| 162 } | 187 } |
| 163 } | 188 } |
| 164 return true; | 189 return true; |
| 165 } | 190 } |
| 166 | 191 |
| OLD | NEW |