aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPipelineBuilder.cpp
blob: ce3871873ad6c1990d611aad83f9a248ed7f50fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrPipelineBuilder.h"

#include "GrBlend.h"
#include "GrPaint.h"
#include "GrPipeline.h"
#include "GrProcOptInfo.h"
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
#include "ops/GrOp.h"

GrPipelineBuilder::GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
        : fFlags(0x0)
        , fUserStencilSettings(&GrUserStencilSettings::kUnused)
        , fDrawFace(GrDrawFace::kBoth)
        , fProcessors(std::move(paint)) {
    this->setState(GrPipelineBuilder::kHWAntialias_Flag, GrAATypeIsHW(aaType));
    // The processors have been moved out of paint, but its flags should still be unmodified.
    this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag,
                   paint.getDisableOutputConversionToSRGB());
    this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag,
                   paint.getAllowSRGBInputs());
    this->setState(GrPipelineBuilder::kUsesDistanceVectorField_Flag,
                   paint.usesDistanceVectorField());
}

bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps,
                                             const GrPipelineAnalysis& analysis) const {
    if (this->getXPFactory()) {
        return this->getXPFactory()->willNeedDstTexture(caps, analysis);
    }
    return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, analysis);
}