aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPaint.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-05-03 14:00:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-03 20:50:40 +0000
commitff574e0eb79b83c2e797dec8f1661378876202d8 (patch)
treefe12d664ddbc0c7e84d284e11e9d25ac66230d37 /src/gpu/GrPaint.h
parentbc4c96bc65ab6ee0acc62d5d8a6613156991ac6c (diff)
Add a new non-AA rect op that does not inherit from GrLegacyMeshDrawOp.
This uses a new helper class, GrSimpleMeshDrawOpHelper, which it uses to fullfill the GrMeshDrawOp contract and to construct its GrPipline when flushed. The helper is intended to be used such that the op only stores a GrProcessorSet if it is constructed with a "nontrivial" GrPaint. "Trivial" currently means no fragment processors and src-over blending. The helper allows the op subclass to specify whether it supports stenciling via a template parameter. The helper class is initially intended to be used for ops that don't have per-vertex colors and construct a single GrPipeline at flush time, though perhaps this can be relaxed in future changes. On the microbenchmark "rotated_rects_bw_same_transparent_srcover" this produces a 18-20% reduction in time on my Z840 running Linux and 33% on my 2010 MacPro. Bug: skia: Change-Id: I9f655827a70bee585b0b0e1255371ffd995a0b80 Reviewed-on: https://skia-review.googlesource.com/14604 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrPaint.h')
-rw-r--r--src/gpu/GrPaint.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gpu/GrPaint.h b/src/gpu/GrPaint.h
index bcf6858df8..6fe561ab33 100644
--- a/src/gpu/GrPaint.h
+++ b/src/gpu/GrPaint.h
@@ -79,11 +79,14 @@ public:
* as such (with linear blending), and sRGB inputs to be filtered and decoded correctly.
*/
void setGammaCorrect(bool gammaCorrect) {
- setDisableOutputConversionToSRGB(!gammaCorrect);
- setAllowSRGBInputs(gammaCorrect);
+ this->setDisableOutputConversionToSRGB(!gammaCorrect);
+ this->setAllowSRGBInputs(gammaCorrect);
}
- void setXPFactory(const GrXPFactory* xpFactory) { fXPFactory = xpFactory; }
+ void setXPFactory(const GrXPFactory* xpFactory) {
+ fXPFactory = xpFactory;
+ fTrivial &= !SkToBool(xpFactory);
+ }
void setPorterDuffXPFactory(SkBlendMode mode);
@@ -96,6 +99,7 @@ public:
SkASSERT(fp);
fUsesDistanceVectorField |= fp->usesDistanceVectorField();
fColorFragmentProcessors.push_back(std::move(fp));
+ fTrivial = false;
}
/**
@@ -105,6 +109,7 @@ public:
SkASSERT(fp);
fUsesDistanceVectorField |= fp->usesDistanceVectorField();
fCoverageFragmentProcessors.push_back(std::move(fp));
+ fTrivial = false;
}
/**
@@ -143,6 +148,12 @@ public:
*/
bool isConstantBlendedColor(GrColor* constantColor) const;
+ /**
+ * A trivial paint is one that uses src-over and has no fragment processors.
+ * It may have variable sRGB settings.
+ **/
+ bool isTrivial() const { return fTrivial; }
+
private:
template <bool> class MoveOrImpl;
@@ -172,6 +183,7 @@ private:
bool fDisableOutputConversionToSRGB = false;
bool fAllowSRGBInputs = false;
bool fUsesDistanceVectorField = false;
+ bool fTrivial = true;
GrColor4f fColor = GrColor4f::OpaqueWhite();
};