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 fClip = clip; | 73 if (clip) { |
| 74 fClip = *clip; |
| 75 } |
74 | 76 |
75 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); | 77 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); |
76 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias()
); | 78 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias()
); |
77 | 79 |
78 fColorProcInfoValid = false; | 80 fColorProcInfoValid = false; |
79 fCoverageProcInfoValid = false; | 81 fCoverageProcInfoValid = false; |
80 | 82 |
81 fColorCache = GrColor_ILLEGAL; | 83 fColorCache = GrColor_ILLEGAL; |
82 fCoverageCache = GrColor_ILLEGAL; | 84 fCoverageCache = GrColor_ILLEGAL; |
83 } | 85 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { | 177 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { |
176 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 178 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
177 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 179 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
178 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 180 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
179 this->numCoverageStages(), cover
age, flags, | 181 this->numCoverageStages(), cover
age, flags, |
180 true); | 182 true); |
181 fCoverageProcInfoValid = true; | 183 fCoverageProcInfoValid = true; |
182 fCoverageCache = coverage; | 184 fCoverageCache = coverage; |
183 } | 185 } |
184 } | 186 } |
OLD | NEW |