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), | 19 : fFlags(0x0), |
20 fUserStencilSettings(&GrUserStencilSettings::kUnused), | 20 fUserStencilSettings(&GrUserStencilSettings::kUnused), |
21 fDrawFace(kBoth_DrawFace) { | 21 fDrawFace(kBoth_DrawFace) { |
22 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 22 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
23 } | 23 } |
24 | 24 |
25 GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, c
onst GrClip& clip) | 25 GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt) |
26 : GrPipelineBuilder() { | 26 : GrPipelineBuilder() { |
27 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 27 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
28 | 28 |
29 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { | 29 for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { |
30 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); | 30 fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor
(i))); |
31 } | 31 } |
32 | 32 |
33 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { | 33 for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { |
34 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); | 34 fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentPro
cessor(i))); |
35 } | 35 } |
36 | 36 |
37 fXPFactory.reset(SkSafeRef(paint.getXPFactory())); | 37 fXPFactory.reset(SkSafeRef(paint.getXPFactory())); |
38 | 38 |
39 this->setRenderTarget(rt); | 39 this->setRenderTarget(rt); |
40 | 40 |
41 fClip = clip; | |
42 | |
43 this->setState(GrPipelineBuilder::kHWAntialias_Flag, | 41 this->setState(GrPipelineBuilder::kHWAntialias_Flag, |
44 rt->isUnifiedMultisampled() && paint.isAntiAlias()); | 42 rt->isUnifiedMultisampled() && paint.isAntiAlias()); |
45 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, | 43 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, |
46 paint.getDisableOutputConversionToSRGB()); | 44 paint.getDisableOutputConversionToSRGB()); |
47 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, | 45 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, |
48 paint.getAllowSRGBInputs()); | 46 paint.getAllowSRGBInputs()); |
49 } | 47 } |
50 | 48 |
51 //////////////////////////////////////////////////////////////////////////////s | 49 //////////////////////////////////////////////////////////////////////////////s |
52 | 50 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 86 |
89 GrPipelineBuilder::~GrPipelineBuilder() { | 87 GrPipelineBuilder::~GrPipelineBuilder() { |
90 SkASSERT(0 == fBlockEffectRemovalCnt); | 88 SkASSERT(0 == fBlockEffectRemovalCnt); |
91 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 89 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
92 fColorFragmentProcessors[i]->unref(); | 90 fColorFragmentProcessors[i]->unref(); |
93 } | 91 } |
94 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 92 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
95 fCoverageFragmentProcessors[i]->unref(); | 93 fCoverageFragmentProcessors[i]->unref(); |
96 } | 94 } |
97 } | 95 } |
OLD | NEW |