| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); | 75 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); |
| 76 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias()
); | 76 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias()
); |
| 77 | 77 |
| 78 fColorProcInfoValid = false; | 78 fColorProcInfoValid = false; |
| 79 fCoverageProcInfoValid = false; | 79 fCoverageProcInfoValid = false; |
| 80 | 80 |
| 81 fColorCache = GrColor_ILLEGAL; | 81 fColorCache = GrColor_ILLEGAL; |
| 82 fCoverageCache = GrColor_ILLEGAL; | 82 fCoverageCache = GrColor_ILLEGAL; |
| 83 } | 83 } |
| 84 | 84 |
| 85 //////////////////////////////////////////////////////////////////////////////// | |
| 86 | |
| 87 bool GrPipelineBuilder::canUseFracCoveragePrimProc(GrColor color, | |
| 88 const GrDrawTargetCaps& caps)
const { | |
| 89 if (caps.dualSourceBlendingSupport()) { | |
| 90 return true; | |
| 91 } | |
| 92 | |
| 93 this->calcColorInvariantOutput(color); | |
| 94 | |
| 95 // The coverage isn't actually white, its unknown, but this will produce the
same effect | |
| 96 // TODO we want to cache the result of this call, but we can probably clean
up the interface | |
| 97 // so we don't have to pass in a seemingly known coverage | |
| 98 this->calcCoverageInvariantOutput(GrColor_WHITE); | |
| 99 return this->getXPFactory()->canApplyCoverage(fColorProcInfo, fCoverageProcI
nfo); | |
| 100 } | |
| 101 | |
| 102 //////////////////////////////////////////////////////////////////////////////s | 85 //////////////////////////////////////////////////////////////////////////////s |
| 103 | 86 |
| 104 bool GrPipelineBuilder::willXPNeedDstCopy(const GrDrawTargetCaps& caps, | 87 bool GrPipelineBuilder::willXPNeedDstCopy(const GrDrawTargetCaps& caps, |
| 105 const GrProcOptInfo& colorPOI, | 88 const GrProcOptInfo& colorPOI, |
| 106 const GrProcOptInfo& coveragePOI) cons
t { | 89 const GrProcOptInfo& coveragePOI) cons
t { |
| 107 return this->getXPFactory()->willNeedDstCopy(caps, colorPOI, coveragePOI); | 90 return this->getXPFactory()->willNeedDstCopy(caps, colorPOI, coveragePOI); |
| 108 } | 91 } |
| 109 | 92 |
| 110 void GrPipelineBuilder::AutoRestoreEffects::set(GrPipelineBuilder* pipelineBuild
er) { | 93 void GrPipelineBuilder::AutoRestoreEffects::set(GrPipelineBuilder* pipelineBuild
er) { |
| 111 if (fPipelineBuilder) { | 94 if (fPipelineBuilder) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { | 175 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { |
| 193 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 176 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
| 194 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 177 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
| 195 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 178 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
| 196 this->numCoverageStages(), cover
age, flags, | 179 this->numCoverageStages(), cover
age, flags, |
| 197 true); | 180 true); |
| 198 fCoverageProcInfoValid = true; | 181 fCoverageProcInfoValid = true; |
| 199 fCoverageCache = coverage; | 182 fCoverageCache = coverage; |
| 200 } | 183 } |
| 201 } | 184 } |
| OLD | NEW |