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