| 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 #include "GrPipelineBuilder.h" | 8 #include "GrPipelineBuilder.h" |
| 9 | 9 |
| 10 #include "GrBlend.h" | 10 #include "GrBlend.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 24 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
| 25 | 25 |
| 26 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { | 26 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { |
| 27 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); | 27 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); |
| 28 } | 28 } |
| 29 | 29 |
| 30 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { | 30 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { |
| 31 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); | 31 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); |
| 32 } | 32 } |
| 33 | 33 |
| 34 fXPFactory.reset(SkRef(paint.getXPFactory())); | 34 fXPFactory.reset(SkSafeRef(paint.getXPFactory())); |
| 35 | 35 |
| 36 this->setRenderTarget(rt); | 36 this->setRenderTarget(rt); |
| 37 | 37 |
| 38 // These have no equivalent in GrPaint, set them to defaults | 38 // These have no equivalent in GrPaint, set them to defaults |
| 39 fDrawFace = kBoth_DrawFace; | 39 fDrawFace = kBoth_DrawFace; |
| 40 fStencilSettings.setDisabled(); | 40 fStencilSettings.setDisabled(); |
| 41 fFlags = 0; | 41 fFlags = 0; |
| 42 | 42 |
| 43 fClip = clip; | 43 fClip = clip; |
| 44 | 44 |
| 45 this->setState(GrPipelineBuilder::kHWAntialias_Flag, | 45 this->setState(GrPipelineBuilder::kHWAntialias_Flag, |
| 46 rt->isUnifiedMultisampled() && paint.isAntiAlias()); | 46 rt->isUnifiedMultisampled() && paint.isAntiAlias()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 //////////////////////////////////////////////////////////////////////////////s | 49 //////////////////////////////////////////////////////////////////////////////s |
| 50 | 50 |
| 51 bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps, | 51 bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps, |
| 52 const GrProcOptInfo& colorPOI, | 52 const GrProcOptInfo& colorPOI, |
| 53 const GrProcOptInfo& coveragePOI) c
onst { | 53 const GrProcOptInfo& coveragePOI) c
onst { |
| 54 return this->getXPFactory()->willNeedDstTexture(caps, colorPOI, coveragePOI, | 54 if (this->getXPFactory()) { |
| 55 this->hasMixedSamples()); | 55 return this->getXPFactory()->willNeedDstTexture(caps, colorPOI, coverage
POI, |
| 56 this->hasMixedSamples())
; |
| 57 } |
| 58 return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, colorPOI, cove
ragePOI, |
| 59 this->hasMixedSample
s()); |
| 56 } | 60 } |
| 57 | 61 |
| 58 void GrPipelineBuilder::AutoRestoreFragmentProcessorState::set( | 62 void GrPipelineBuilder::AutoRestoreFragmentProcessorState::set( |
| 59 const GrPipelineBuilder
* pipelineBuilder) { | 63 const GrPipelineBuilder
* pipelineBuilder) { |
| 60 if (fPipelineBuilder) { | 64 if (fPipelineBuilder) { |
| 61 int m = fPipelineBuilder->numColorFragmentProcessors() - fColorEffectCnt
; | 65 int m = fPipelineBuilder->numColorFragmentProcessors() - fColorEffectCnt
; |
| 62 SkASSERT(m >= 0); | 66 SkASSERT(m >= 0); |
| 63 for (int i = 0; i < m; ++i) { | 67 for (int i = 0; i < m; ++i) { |
| 64 fPipelineBuilder->fColorFragmentProcessors.fromBack(i)->unref(); | 68 fPipelineBuilder->fColorFragmentProcessors.fromBack(i)->unref(); |
| 65 } | 69 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void GrPipelineBuilder::calcColorInvariantOutput(const GrDrawBatch* batch) const
{ | 102 void GrPipelineBuilder::calcColorInvariantOutput(const GrDrawBatch* batch) const
{ |
| 99 fColorProcInfo.calcColorWithBatch(batch, fColorFragmentProcessors.begin(), | 103 fColorProcInfo.calcColorWithBatch(batch, fColorFragmentProcessors.begin(), |
| 100 this->numColorFragmentProcessors()); | 104 this->numColorFragmentProcessors()); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void GrPipelineBuilder::calcCoverageInvariantOutput(const GrDrawBatch* batch) co
nst { | 107 void GrPipelineBuilder::calcCoverageInvariantOutput(const GrDrawBatch* batch) co
nst { |
| 104 fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageFragmentProcessors.b
egin(), | 108 fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageFragmentProcessors.b
egin(), |
| 105 this->numCoverageFragmentProcessors(
)); | 109 this->numCoverageFragmentProcessors(
)); |
| 106 } | 110 } |
| 107 | 111 |
| OLD | NEW |