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