10 #ifndef GrPaint_DEFINED
11 #define GrPaint_DEFINED
14 #include "GrColorSpaceXform.h"
15 #include "GrXferProcessor.h"
16 #include "effects/GrPorterDuffXferProcessor.h"
17 #include "GrFragmentProcessor.h"
21 #include "SkXfermode.h"
53 const GrColor4f& getColor4f()
const {
return fColor; }
58 GrColor
getColor()
const {
return fColor.toGrColor(); }
64 bool isAntiAlias()
const {
return fAntiAlias; }
71 bool getDisableOutputConversionToSRGB()
const {
return fDisableOutputConversionToSRGB; }
78 bool getAllowSRGBInputs()
const {
return fAllowSRGBInputs; }
95 fXPFactory = std::move(xpFactory);
99 fXPFactory = GrPorterDuffXPFactory::Make(mode);
102 void setCoverageSetOpXPFactory(
SkRegion::Op regionOp,
bool invertCoverage =
false);
110 fColorFragmentProcessors.push_back(std::move(fp));
119 fCoverageFragmentProcessors.push_back(std::move(fp));
132 int numColorFragmentProcessors()
const {
return fColorFragmentProcessors.count(); }
133 int numCoverageFragmentProcessors()
const {
return fCoverageFragmentProcessors.count(); }
134 int numTotalFragmentProcessors()
const {
return this->numColorFragmentProcessors() +
135 this->numCoverageFragmentProcessors(); }
138 return fXPFactory.get();
142 return fColorFragmentProcessors[i].get();
145 return fCoverageFragmentProcessors[i].get();
149 fAntiAlias = paint.fAntiAlias;
150 fDisableOutputConversionToSRGB = paint.fDisableOutputConversionToSRGB;
151 fAllowSRGBInputs = paint.fAllowSRGBInputs;
152 fUsesDistanceVectorField = paint.fUsesDistanceVectorField;
154 fColor = paint.fColor;
155 fColorFragmentProcessors = paint.fColorFragmentProcessors;
156 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors;
158 fXPFactory = paint.fXPFactory;
170 GrColor paintColor = this->
getColor();
171 if (!fXPFactory && fColorFragmentProcessors.empty()) {
172 if (!GrColorIsOpaque(paintColor)) {
175 *constantColor = paintColor;
178 return this->internalIsConstantBlendedColor(paintColor, constantColor);
182 bool internalIsConstantBlendedColor(GrColor paintColor, GrColor* constantColor)
const;
185 SkSTArray<4, sk_sp<GrFragmentProcessor>> fColorFragmentProcessors;
186 SkSTArray<2, sk_sp<GrFragmentProcessor>> fCoverageFragmentProcessors;
189 bool fDisableOutputConversionToSRGB;
190 bool fAllowSRGBInputs;
191 bool fUsesDistanceVectorField;
void setAntiAlias(bool aa)
Should primitives be anti-aliased or not.
Definition: GrPaint.h:63
void setAllowSRGBInputs(bool allowSRGBInputs)
Should sRGB inputs be allowed to perform sRGB to linear conversion.
Definition: GrPaint.h:77
Provides custom fragment shader code.
Definition: GrFragmentProcessor.h:24
Mode
List of predefined xfermodes.
Definition: SkXfermode.h:71
Represents the filtering and tile modes used to access a texture.
Definition: GrTextureParams.h:17
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
bool usesDistanceVectorField() const
Does this FP need a vector to the nearest edge?
Definition: GrFragmentProcessor.h:115
void setGammaCorrect(bool gammaCorrect)
Should rendering be gamma-correct, end-to-end.
Definition: GrPaint.h:89
GrColor getColor() const
Legacy getter, until all code handles 4f directly.
Definition: GrPaint.h:58
bool usesDistanceVectorField() const
Does one of the fragment processors need a field of distance vectors to the nearest edge...
Definition: GrPaint.h:83
Similarly, GrColor4f is 4 floats for R, G, B, A, in that order.
Definition: GrColor.h:177
void setDisableOutputConversionToSRGB(bool srgb)
Should shader output conversion from linear to sRGB be disabled.
Definition: GrPaint.h:70
void addColorFragmentProcessor(sk_sp< GrFragmentProcessor > fp)
Appends an additional color processor to the color computation.
Definition: GrPaint.h:107
bool isConstantBlendedColor(GrColor *constantColor) const
Returns true if the paint's output color will be constant after blending.
Definition: GrPaint.h:169
The paint describes how color and coverage are computed at each pixel by GrContext draw functions and...
Definition: GrPaint.h:41
void addColorTextureProcessor(GrTexture *, sk_sp< GrColorSpaceXform >, const SkMatrix &)
Helpers for adding color or coverage effects that sample a texture.
void addCoverageFragmentProcessor(sk_sp< GrFragmentProcessor > fp)
Appends an additional coverage processor to the coverage computation.
Definition: GrPaint.h:116
void setColor4f(const GrColor4f &color)
The initial color of the drawn primitive.
Definition: GrPaint.h:52
Definition: GrTexture.h:19
Op
The logical operations that can be performed when combining two regions.
Definition: SkRegion.h:239
We install a GrXPFactory (XPF) early on in the pipeline before all the final draw information is know...
Definition: GrXferProcessor.h:301