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" |
11 #include "GrPaint.h" | 11 #include "GrPaint.h" |
12 #include "GrPipeline.h" | 12 #include "GrPipeline.h" |
13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
14 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
15 #include "batches/GrBatch.h" | 15 #include "batches/GrBatch.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
17 | 17 |
18 GrPipelineBuilder::GrPipelineBuilder() | 18 GrPipelineBuilder::GrPipelineBuilder() |
19 : fFlags(0x0), fDrawFace(kBoth_DrawFace) { | 19 : fFlags(0x0), |
| 20 fUserStencilSettings(&GrUserStencilSettings::kUnused), |
| 21 fDrawFace(kBoth_DrawFace) { |
20 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 22 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
21 } | 23 } |
22 | 24 |
23 GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, c
onst GrClip& clip) { | 25 GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, c
onst GrClip& clip) |
| 26 : GrPipelineBuilder() { |
24 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 27 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
25 | 28 |
26 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { | 29 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { |
27 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); | 30 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); |
28 } | 31 } |
29 | 32 |
30 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { | 33 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { |
31 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); | 34 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); |
32 } | 35 } |
33 | 36 |
34 fXPFactory.reset(SkSafeRef(paint.getXPFactory())); | 37 fXPFactory.reset(SkSafeRef(paint.getXPFactory())); |
35 | 38 |
36 this->setRenderTarget(rt); | 39 this->setRenderTarget(rt); |
37 | 40 |
38 // These have no equivalent in GrPaint, set them to defaults | |
39 fDrawFace = kBoth_DrawFace; | |
40 fStencilSettings.setDisabled(); | |
41 fFlags = 0; | |
42 | |
43 fClip = clip; | 41 fClip = clip; |
44 | 42 |
45 this->setState(GrPipelineBuilder::kHWAntialias_Flag, | 43 this->setState(GrPipelineBuilder::kHWAntialias_Flag, |
46 rt->isUnifiedMultisampled() && paint.isAntiAlias()); | 44 rt->isUnifiedMultisampled() && paint.isAntiAlias()); |
47 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, | 45 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, |
48 paint.getDisableOutputConversionToSRGB()); | 46 paint.getDisableOutputConversionToSRGB()); |
49 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, | 47 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, |
50 paint.getAllowSRGBInputs()); | 48 paint.getAllowSRGBInputs()); |
51 } | 49 } |
52 | 50 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 88 |
91 GrPipelineBuilder::~GrPipelineBuilder() { | 89 GrPipelineBuilder::~GrPipelineBuilder() { |
92 SkASSERT(0 == fBlockEffectRemovalCnt); | 90 SkASSERT(0 == fBlockEffectRemovalCnt); |
93 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 91 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
94 fColorFragmentProcessors[i]->unref(); | 92 fColorFragmentProcessors[i]->unref(); |
95 } | 93 } |
96 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 94 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
97 fCoverageFragmentProcessors[i]->unref(); | 95 fCoverageFragmentProcessors[i]->unref(); |
98 } | 96 } |
99 } | 97 } |
OLD | NEW |