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) | 25 GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, bool targetHasUnified
Multisampling) |
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); | |
40 | |
41 this->setState(GrPipelineBuilder::kHWAntialias_Flag, | 39 this->setState(GrPipelineBuilder::kHWAntialias_Flag, |
42 rt->isUnifiedMultisampled() && paint.isAntiAlias()); | 40 targetHasUnifiedMultisampling && paint.isAntiAlias()); |
43 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, | 41 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, |
44 paint.getDisableOutputConversionToSRGB()); | 42 paint.getDisableOutputConversionToSRGB()); |
45 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, | 43 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, |
46 paint.getAllowSRGBInputs()); | 44 paint.getAllowSRGBInputs()); |
47 } | 45 } |
48 | 46 |
49 //////////////////////////////////////////////////////////////////////////////s | 47 //////////////////////////////////////////////////////////////////////////////s |
50 | 48 |
51 bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps, | 49 bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps, |
52 const GrPipelineOptimizations& opti
mizations) const { | 50 const GrPipelineOptimizations& opti
mizations) const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 84 |
87 GrPipelineBuilder::~GrPipelineBuilder() { | 85 GrPipelineBuilder::~GrPipelineBuilder() { |
88 SkASSERT(0 == fBlockEffectRemovalCnt); | 86 SkASSERT(0 == fBlockEffectRemovalCnt); |
89 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 87 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
90 fColorFragmentProcessors[i]->unref(); | 88 fColorFragmentProcessors[i]->unref(); |
91 } | 89 } |
92 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 90 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
93 fCoverageFragmentProcessors[i]->unref(); | 91 fCoverageFragmentProcessors[i]->unref(); |
94 } | 92 } |
95 } | 93 } |
OLD | NEW |