| 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 "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 fCoverageCache = that.fCoverageCache; | 41 fCoverageCache = that.fCoverageCache; |
| 42 if (fColorProcInfoValid) { | 42 if (fColorProcInfoValid) { |
| 43 fColorProcInfo = that.fColorProcInfo; | 43 fColorProcInfo = that.fColorProcInfo; |
| 44 } | 44 } |
| 45 if (fCoverageProcInfoValid) { | 45 if (fCoverageProcInfoValid) { |
| 46 fCoverageProcInfo = that.fCoverageProcInfo; | 46 fCoverageProcInfo = that.fCoverageProcInfo; |
| 47 } | 47 } |
| 48 return *this; | 48 return *this; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt, c
onst GrClip& clip) { | 51 void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt, c
onst GrClip& clip, |
| 52 GrRenderTarget::PipelineStage pipelineStage
) { |
| 52 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages()); | 53 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages()); |
| 53 | 54 |
| 54 fColorStages.reset(); | 55 fColorStages.reset(); |
| 55 fCoverageStages.reset(); | 56 fCoverageStages.reset(); |
| 56 | 57 |
| 57 for (int i = 0; i < paint.numColorStages(); ++i) { | 58 for (int i = 0; i < paint.numColorStages(); ++i) { |
| 58 fColorStages.push_back(paint.getColorStage(i)); | 59 fColorStages.push_back(paint.getColorStage(i)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 for (int i = 0; i < paint.numCoverageStages(); ++i) { | 62 for (int i = 0; i < paint.numCoverageStages(); ++i) { |
| 62 fCoverageStages.push_back(paint.getCoverageStage(i)); | 63 fCoverageStages.push_back(paint.getCoverageStage(i)); |
| 63 } | 64 } |
| 64 | 65 |
| 65 fXPFactory.reset(SkRef(paint.getXPFactory())); | 66 fXPFactory.reset(SkRef(paint.getXPFactory())); |
| 66 | 67 |
| 67 this->setRenderTarget(rt); | 68 this->setRenderTarget(rt); |
| 68 | 69 |
| 69 // These have no equivalent in GrPaint, set them to defaults | 70 // These have no equivalent in GrPaint, set them to defaults |
| 70 fDrawFace = kBoth_DrawFace; | 71 fDrawFace = kBoth_DrawFace; |
| 71 fStencilSettings.setDisabled(); | 72 fStencilSettings.setDisabled(); |
| 72 fFlagBits = 0; | 73 fFlagBits = 0; |
| 73 | 74 |
| 74 fClip = clip; | 75 fClip = clip; |
| 75 | 76 |
| 76 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); | 77 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); |
| 77 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, | 78 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, |
| 78 rt->isMultisampled() && paint.isAntiAlias()); | 79 rt->isMultisampled(pipelineStage) && paint.isAntiAlias()); |
| 79 | 80 |
| 80 fColorProcInfoValid = false; | 81 fColorProcInfoValid = false; |
| 81 fCoverageProcInfoValid = false; | 82 fCoverageProcInfoValid = false; |
| 82 | 83 |
| 83 fColorCache = GrColor_ILLEGAL; | 84 fColorCache = GrColor_ILLEGAL; |
| 84 fCoverageCache = GrColor_ILLEGAL; | 85 fCoverageCache = GrColor_ILLEGAL; |
| 85 } | 86 } |
| 86 | 87 |
| 87 //////////////////////////////////////////////////////////////////////////////s | 88 //////////////////////////////////////////////////////////////////////////////s |
| 88 | 89 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { | 178 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { |
| 178 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 179 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
| 179 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 180 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
| 180 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 181 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
| 181 this->numCoverageFragmentStages(
), coverage, flags, | 182 this->numCoverageFragmentStages(
), coverage, flags, |
| 182 true); | 183 true); |
| 183 fCoverageProcInfoValid = true; | 184 fCoverageProcInfoValid = true; |
| 184 fCoverageCache = coverage; | 185 fCoverageCache = coverage; |
| 185 } | 186 } |
| 186 } | 187 } |
| OLD | NEW |