bsalomon@google.com | af84e74 | 2012-10-05 13:23:24 +0000 | [diff] [blame] | 1 | /* |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 2 | * Copyright 2015 Google Inc. |
bsalomon@google.com | af84e74 | 2012-10-05 13:23:24 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 8 | #include "GrPipelineBuilder.h" |
egdaniel | 3658f38 | 2014-09-15 07:01:59 -0700 | [diff] [blame] | 9 | |
egdaniel | b1cff03 | 2014-11-13 06:19:25 -0800 | [diff] [blame] | 10 | #include "GrBlend.h" |
egdaniel | 3658f38 | 2014-09-15 07:01:59 -0700 | [diff] [blame] | 11 | #include "GrPaint.h" |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 12 | #include "GrPipeline.h" |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 13 | #include "GrProcOptInfo.h" |
egdaniel | 378092f | 2014-12-03 10:40:13 -0800 | [diff] [blame] | 14 | #include "GrXferProcessor.h" |
| 15 | #include "effects/GrPorterDuffXferProcessor.h" |
Brian Salomon | 8952743 | 2016-12-16 09:52:16 -0500 | [diff] [blame] | 16 | #include "ops/GrOp.h" |
egdaniel | 3658f38 | 2014-09-15 07:01:59 -0700 | [diff] [blame] | 17 | |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 18 | GrPipelineBuilder::GrPipelineBuilder(GrPaint&& paint, GrAAType aaType) |
Brian Salomon | 0e8fc8b | 2016-12-09 15:10:07 -0500 | [diff] [blame] | 19 | : fFlags(0x0) |
| 20 | , fUserStencilSettings(&GrUserStencilSettings::kUnused) |
Brian Salomon | 92ce594 | 2017-01-18 11:01:10 -0500 | [diff] [blame] | 21 | , fDrawFace(GrDrawFace::kBoth) |
| 22 | , fProcessors(std::move(paint)) { |
Brian Salomon | 0abc8b4 | 2016-12-13 10:22:54 -0500 | [diff] [blame] | 23 | this->setState(GrPipelineBuilder::kHWAntialias_Flag, GrAATypeIsHW(aaType)); |
Brian Salomon | 92ce594 | 2017-01-18 11:01:10 -0500 | [diff] [blame] | 24 | // The processors have been moved out of paint, but its flags should still be unmodified. |
brianosman | 64d094d | 2016-03-25 06:01:59 -0700 | [diff] [blame] | 25 | this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag, |
| 26 | paint.getDisableOutputConversionToSRGB()); |
brianosman | 898235c | 2016-04-06 07:38:23 -0700 | [diff] [blame] | 27 | this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, |
| 28 | paint.getAllowSRGBInputs()); |
dvonbeck | 9b03e7b | 2016-08-01 11:01:56 -0700 | [diff] [blame] | 29 | this->setState(GrPipelineBuilder::kUsesDistanceVectorField_Flag, |
| 30 | paint.usesDistanceVectorField()); |
bsalomon@google.com | af84e74 | 2012-10-05 13:23:24 +0000 | [diff] [blame] | 31 | } |
bsalomon@google.com | 5b3e890 | 2012-10-05 20:13:28 +0000 | [diff] [blame] | 32 | |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 33 | bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps, |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 34 | const GrPipelineAnalysis& analysis) const { |
egdaniel | c4b7272 | 2015-11-23 13:20:41 -0800 | [diff] [blame] | 35 | if (this->getXPFactory()) { |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 36 | return this->getXPFactory()->willNeedDstTexture(caps, analysis); |
egdaniel | c4b7272 | 2015-11-23 13:20:41 -0800 | [diff] [blame] | 37 | } |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 38 | return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, analysis); |
egdaniel | 89af44a | 2014-09-26 06:15:04 -0700 | [diff] [blame] | 39 | } |