aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrCoverageSetOpXP.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-18 12:44:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-18 12:44:55 -0800
commit9e4ecdc9f86724dcce23dc7546e2f295b901407b (patch)
tree9b3178883194b538f6f7371b8b432ca9a5d71514 /src/gpu/effects/GrCoverageSetOpXP.cpp
parentcaf7e9313b52f78b53ff7d478f9cc41a1f6a85ff (diff)
Add an InvariantOutput for the XPF.
The Invariant output holds information about final post blended color and other general information like will it blend with dst. Having this new struct allowed me to also remove some functions that were previously querying subsets of the invariant output. BUG=skia: Review URL: https://codereview.chromium.org/814933002
Diffstat (limited to 'src/gpu/effects/GrCoverageSetOpXP.cpp')
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index cddbbfb49e..d956cd31b0 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -186,40 +186,27 @@ GrXferProcessor* GrCoverageSetOpXPFactory::createXferProcessor(const GrProcOptIn
return GrCoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
}
-bool GrCoverageSetOpXPFactory::willBlendWithDst(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool colorWriteDisabled) const {
- // TODO: once all SkXferEffects are XP's then we will never reads dst here since only XP's
- // will readDst and this XP doesn't read dst.
- if (coveragePOI.readsDst()) {
- return true;
- }
-
- // Besides Replace all other SkRegion ops will either have a src coeff that references dst or a
- // non zero dst coeff
- return SkRegion::kReplace_Op != fRegionOp;
-}
-
-bool GrCoverageSetOpXPFactory::getOpaqueAndKnownColor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrColor* solidColor,
- uint32_t* solidColorKnownComponents) const {
- if (!coveragePOI.isSolidWhite()) {
- return false;
- }
-
- SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents));
+void GrCoverageSetOpXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool colorWriteDisabled,
+ GrXPFactory::InvariantOutput* output) const {
+ if (SkRegion::kReplace_Op == fRegionOp) {
+ if (coveragePOI.isSolidWhite()) {
+ output->fBlendedColor = GrColor_WHITE;
+ output->fBlendedColorFlags = kRGBA_GrColorComponentFlags;
+ } else {
+ output->fBlendedColorFlags = 0;
+ }
- bool opaque = SkRegion::kReplace_Op == fRegionOp;
- if (solidColor) {
- if (opaque) {
- *solidColor = GrColor_WHITE;
- *solidColorKnownComponents = kRGBA_GrColorComponentFlags;
+ if (coveragePOI.readsDst()) {
+ output->fWillBlendWithDst = true;
} else {
- solidColorKnownComponents = 0;
+ output->fWillBlendWithDst = false;
}
+ } else {
+ output->fBlendedColorFlags = 0;
+ output->fWillBlendWithDst = true;
}
- return opaque;
}
GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory);