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