blob: ce3871873ad6c1990d611aad83f9a248ed7f50fe [file] [log] [blame]
bsalomon@google.comaf84e742012-10-05 13:23:24 +00001/*
egdaniel8dd688b2015-01-22 10:16:09 -08002 * Copyright 2015 Google Inc.
bsalomon@google.comaf84e742012-10-05 13:23:24 +00003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
egdaniel8dd688b2015-01-22 10:16:09 -08008#include "GrPipelineBuilder.h"
egdaniel3658f382014-09-15 07:01:59 -07009
egdanielb1cff032014-11-13 06:19:25 -080010#include "GrBlend.h"
egdaniel3658f382014-09-15 07:01:59 -070011#include "GrPaint.h"
egdaniel8dd688b2015-01-22 10:16:09 -080012#include "GrPipeline.h"
egdanielb6cbc382014-11-13 11:00:34 -080013#include "GrProcOptInfo.h"
egdaniel378092f2014-12-03 10:40:13 -080014#include "GrXferProcessor.h"
15#include "effects/GrPorterDuffXferProcessor.h"
Brian Salomon89527432016-12-16 09:52:16 -050016#include "ops/GrOp.h"
egdaniel3658f382014-09-15 07:01:59 -070017
Brian Salomon82f44312017-01-11 13:42:54 -050018GrPipelineBuilder::GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
Brian Salomon0e8fc8b2016-12-09 15:10:07 -050019 : fFlags(0x0)
20 , fUserStencilSettings(&GrUserStencilSettings::kUnused)
Brian Salomon92ce5942017-01-18 11:01:10 -050021 , fDrawFace(GrDrawFace::kBoth)
22 , fProcessors(std::move(paint)) {
Brian Salomon0abc8b42016-12-13 10:22:54 -050023 this->setState(GrPipelineBuilder::kHWAntialias_Flag, GrAATypeIsHW(aaType));
Brian Salomon92ce5942017-01-18 11:01:10 -050024 // The processors have been moved out of paint, but its flags should still be unmodified.
brianosman64d094d2016-03-25 06:01:59 -070025 this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag,
26 paint.getDisableOutputConversionToSRGB());
brianosman898235c2016-04-06 07:38:23 -070027 this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag,
28 paint.getAllowSRGBInputs());
dvonbeck9b03e7b2016-08-01 11:01:56 -070029 this->setState(GrPipelineBuilder::kUsesDistanceVectorField_Flag,
30 paint.usesDistanceVectorField());
bsalomon@google.comaf84e742012-10-05 13:23:24 +000031}
bsalomon@google.com5b3e8902012-10-05 20:13:28 +000032
bsalomon6a44c6a2015-05-26 09:49:05 -070033bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps,
Brian Salomon92aee3d2016-12-21 09:20:25 -050034 const GrPipelineAnalysis& analysis) const {
egdanielc4b72722015-11-23 13:20:41 -080035 if (this->getXPFactory()) {
Brian Salomon92aee3d2016-12-21 09:20:25 -050036 return this->getXPFactory()->willNeedDstTexture(caps, analysis);
egdanielc4b72722015-11-23 13:20:41 -080037 }
Brian Salomon92aee3d2016-12-21 09:20:25 -050038 return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, analysis);
egdaniel89af44a2014-09-26 06:15:04 -070039}