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" |
11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
12 #include "GrPaint.h" | 12 #include "GrPaint.h" |
13 #include "GrPipeline.h" | 13 #include "GrPipeline.h" |
14 #include "GrProcOptInfo.h" | 14 #include "GrProcOptInfo.h" |
15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
17 | 17 |
18 GrPipelineBuilder::GrPipelineBuilder() | 18 GrPipelineBuilder::GrPipelineBuilder() |
19 : fFlagBits(0x0) | 19 : fFlags(0x0) |
20 , fDrawFace(kBoth_DrawFace) | 20 , fDrawFace(kBoth_DrawFace) |
21 , fColorProcInfoValid(false) | 21 , fColorProcInfoValid(false) |
22 , fCoverageProcInfoValid(false) | 22 , fCoverageProcInfoValid(false) |
23 , fColorCache(GrColor_ILLEGAL) | 23 , fColorCache(GrColor_ILLEGAL) |
24 , fCoverageCache(GrColor_ILLEGAL) { | 24 , fCoverageCache(GrColor_ILLEGAL) { |
25 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 25 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
26 } | 26 } |
27 | 27 |
28 GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) { | 28 GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) { |
29 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); | 29 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); |
30 fFlagBits = that.fFlagBits; | 30 fFlags = that.fFlags; |
31 fStencilSettings = that.fStencilSettings; | 31 fStencilSettings = that.fStencilSettings; |
32 fDrawFace = that.fDrawFace; | 32 fDrawFace = that.fDrawFace; |
33 fXPFactory.reset(SkRef(that.getXPFactory())); | 33 fXPFactory.reset(SkRef(that.getXPFactory())); |
34 fColorStages = that.fColorStages; | 34 fColorStages = that.fColorStages; |
35 fCoverageStages = that.fCoverageStages; | 35 fCoverageStages = that.fCoverageStages; |
36 fClip = that.fClip; | 36 fClip = that.fClip; |
37 | 37 |
38 fColorProcInfoValid = that.fColorProcInfoValid; | 38 fColorProcInfoValid = that.fColorProcInfoValid; |
39 fCoverageProcInfoValid = that.fCoverageProcInfoValid; | 39 fCoverageProcInfoValid = that.fCoverageProcInfoValid; |
40 fColorCache = that.fColorCache; | 40 fColorCache = that.fColorCache; |
(...skipping 21 matching lines...) Expand all Loading... |
62 fCoverageStages.push_back(paint.getCoverageStage(i)); | 62 fCoverageStages.push_back(paint.getCoverageStage(i)); |
63 } | 63 } |
64 | 64 |
65 fXPFactory.reset(SkRef(paint.getXPFactory())); | 65 fXPFactory.reset(SkRef(paint.getXPFactory())); |
66 | 66 |
67 this->setRenderTarget(rt); | 67 this->setRenderTarget(rt); |
68 | 68 |
69 // These have no equivalent in GrPaint, set them to defaults | 69 // These have no equivalent in GrPaint, set them to defaults |
70 fDrawFace = kBoth_DrawFace; | 70 fDrawFace = kBoth_DrawFace; |
71 fStencilSettings.setDisabled(); | 71 fStencilSettings.setDisabled(); |
72 fFlagBits = 0; | 72 fFlags = 0; |
73 | 73 |
74 fClip = clip; | 74 fClip = clip; |
75 | 75 |
76 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); | 76 this->setState(GrPipelineBuilder::kDither_Flag, paint.isDither()); |
77 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, | 77 this->setState(GrPipelineBuilder::kHWAntialias_Flag, |
78 rt->isMultisampled() && paint.isAntiAlias()); | 78 rt->isMultisampled() && paint.isAntiAlias()); |
79 | 79 |
80 fColorProcInfoValid = false; | 80 fColorProcInfoValid = false; |
81 fCoverageProcInfoValid = false; | 81 fCoverageProcInfoValid = false; |
82 | 82 |
83 fColorCache = GrColor_ILLEGAL; | 83 fColorCache = GrColor_ILLEGAL; |
84 fCoverageCache = GrColor_ILLEGAL; | 84 fCoverageCache = GrColor_ILLEGAL; |
85 } | 85 } |
86 | 86 |
87 //////////////////////////////////////////////////////////////////////////////s | 87 //////////////////////////////////////////////////////////////////////////////s |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { | 177 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { |
178 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 178 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
179 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 179 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
180 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 180 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
181 this->numCoverageFragmentStages(
), coverage, flags, | 181 this->numCoverageFragmentStages(
), coverage, flags, |
182 true); | 182 true); |
183 fCoverageProcInfoValid = true; | 183 fCoverageProcInfoValid = true; |
184 fCoverageCache = coverage; | 184 fCoverageCache = coverage; |
185 } | 185 } |
186 } | 186 } |
OLD | NEW |