Simplify GrPaint::isConstantBlendedColor to avoid FP analysis and XP virtual calls
This was the only non-test user of GrXPFactory::isConstantPreCoverageBlendedColor which is now removed.
Change-Id: Ic1c130d30a44e1a955b89f8912433a3c9df2e61e
Reviewed-on: https://skia-review.googlesource.com/8776
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 2649b9e..edeec3f 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -149,15 +149,22 @@
* not seem constant, even if this function returns true.
*/
bool isConstantBlendedColor(GrColor* constantColor) const {
- GrColor paintColor = this->getColor();
- if (!fXPFactory && fColorFragmentProcessors.empty()) {
- if (!GrColorIsOpaque(paintColor)) {
- return false;
- }
- *constantColor = paintColor;
+ // This used to do a more sophisticated analysis but now it just explicitly looks for common
+ // cases.
+ static const GrXPFactory* kSrc = GrPorterDuffXPFactory::Get(SkBlendMode::kSrc);
+ static const GrXPFactory* kClear = GrPorterDuffXPFactory::Get(SkBlendMode::kClear);
+ if (kClear == fXPFactory) {
+ *constantColor = GrColor_TRANSPARENT_BLACK;
return true;
}
- return this->internalIsConstantBlendedColor(paintColor, constantColor);
+ if (this->numColorFragmentProcessors()) {
+ return false;
+ }
+ if (kSrc == fXPFactory || (!fXPFactory && fColor.isOpaque())) {
+ *constantColor = fColor.toGrColor();
+ return true;
+ }
+ return false;
}
private:
@@ -183,8 +190,6 @@
friend class GrProcessorSet;
- bool internalIsConstantBlendedColor(GrColor paintColor, GrColor* constantColor) const;
-
const GrXPFactory* fXPFactory = nullptr;
SkSTArray<4, sk_sp<GrFragmentProcessor>> fColorFragmentProcessors;
SkSTArray<2, sk_sp<GrFragmentProcessor>> fCoverageFragmentProcessors;
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 5aff17f..9cb7189 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -328,17 +328,7 @@
static bool WillReadDst(const GrXPFactory*, const GrProcOptInfo& colorInput,
const GrProcOptInfo& coverageInput);
- /**
- * Most of the time GrXferProcessor performs a blend of the src and dst colors and then applies
- * the coverage using c*b + (1-c)*d where c is coverage, b=F(s,d) is the blended color, s is the
- * source color, and d is the destination color. This query answers the question "is b a
- * constant and if so what is its value?" If the XP ignores the source color or applies the
- * coverage in some other fashion then this returns false.
- */
- static bool IsPreCoverageBlendedColorConstant(const GrXPFactory*,
- const GrProcOptInfo& colorInput, GrColor* color);
-
- /**
+ /**
* This will return true if the xfer processor needs the dst color in the shader and the way
* that the color will be made available to the xfer processor is by sampling a texture.
*/
@@ -356,10 +346,6 @@
}
private:
- /** Subclass-specific implementation of IsPreCoverageBlendedColorConstant(). */
- virtual bool isPreCoverageBlendedColorConstant(const GrProcOptInfo& colorInput,
- GrColor* color) const = 0;
-
/** Subclass-specific implementation of WillReadDst(). */
virtual bool willReadsDst(const GrProcOptInfo& colorInput,
const GrProcOptInfo& coverageInput) const = 0;
diff --git a/include/gpu/effects/GrCoverageSetOpXP.h b/include/gpu/effects/GrCoverageSetOpXP.h
index 7781b84..7c9f909 100644
--- a/include/gpu/effects/GrCoverageSetOpXP.h
+++ b/include/gpu/effects/GrCoverageSetOpXP.h
@@ -32,10 +32,6 @@
private:
constexpr GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
- bool isPreCoverageBlendedColorConstant(const GrProcOptInfo&, GrColor*) const override {
- return false;
- }
-
bool willReadsDst(const GrProcOptInfo&, const GrProcOptInfo&) const override {
return fRegionOp != SkRegion::kReplace_Op;
}
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index 3a404f4..e6e676d 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -47,7 +47,6 @@
private:
constexpr GrPorterDuffXPFactory(SkBlendMode);
- bool isPreCoverageBlendedColorConstant(const GrProcOptInfo&, GrColor*) const override;
bool willReadsDst(const GrProcOptInfo&, const GrProcOptInfo&) const override;
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index d17b9ab..6d37adf 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -74,12 +74,3 @@
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(ctx, std::move(proxy),
nullptr, matrix, params));
}
-
-bool GrPaint::internalIsConstantBlendedColor(GrColor paintColor, GrColor* color) const {
- GrProcOptInfo colorProcInfo((GrPipelineInput(paintColor)));
- colorProcInfo.analyzeProcessors(
- sk_sp_address_as_pointer_address(fColorFragmentProcessors.begin()),
- this->numColorFragmentProcessors());
-
- return GrXPFactory::IsPreCoverageBlendedColorConstant(fXPFactory, colorProcInfo, color);
-}
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index e6a1817..0d93079 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -211,15 +211,6 @@
return GrPorterDuffXPFactory::WillSrcOverReadDst(colorInput, coverageInput);
}
-bool GrXPFactory::IsPreCoverageBlendedColorConstant(const GrXPFactory* factory,
- const GrProcOptInfo& colorInput,
- GrColor* color) {
- if (factory) {
- return factory->isPreCoverageBlendedColorConstant(colorInput, color);
- }
- return GrPorterDuffXPFactory::IsSrcOverPreCoverageBlendedColorConstant(colorInput, color);
-}
-
bool GrXPFactory::willReadDstInShader(const GrCaps& caps,
const GrPipelineAnalysis& analysis) const {
if (analysis.fUsesPLSDstRead) {
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 36936f8..43042e2 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -338,11 +338,6 @@
bool hasMixedSamples,
const DstTexture*) const override;
- bool isPreCoverageBlendedColorConstant(const GrProcOptInfo& colorInput,
- GrColor* color) const override {
- return false;
- }
-
bool willReadsDst(const GrProcOptInfo&, const GrProcOptInfo&) const override { return true; }
bool willReadDstInShader(const GrCaps&, ColorType, CoverageType) const override;
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index e98e71e..e6a8d59 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -24,10 +24,6 @@
static const GrXPFactory* Get();
private:
- bool isPreCoverageBlendedColorConstant(const GrProcOptInfo&, GrColor*) const override {
- return false;
- }
-
bool willReadsDst(const GrProcOptInfo& colorInput,
const GrProcOptInfo& coverageInput) const override {
return false;
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 6b7d0ba..1554b0c 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -765,23 +765,6 @@
SkASSERT(!dstTexture || !dstTexture->texture());
return new PorterDuffXferProcessor(blendFormula);
}
-bool GrPorterDuffXPFactory::isPreCoverageBlendedColorConstant(const GrProcOptInfo& colorInput,
- GrColor* color) const {
- BlendFormula colorFormula = gBlendTable[colorInput.isOpaque()][0][(int)fBlendMode];
- SkASSERT(kAdd_GrBlendEquation == colorFormula.fBlendEquation);
- if (colorFormula.usesDstColor()) {
- return false;
- }
- switch (colorFormula.fSrcCoeff) {
- case kZero_GrBlendCoeff:
- *color = GrColor_TRANSPARENT_BLACK;
- return true;
- case kOne_GrBlendCoeff:
- return colorInput.hasKnownOutputColor(color);
- default:
- return false;
- }
-}
bool GrPorterDuffXPFactory::willReadsDst(const GrProcOptInfo& colorInput,
const GrProcOptInfo& coverageInput) const {
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 693481a..a193162 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -69,8 +69,6 @@
const GrPipelineAnalysis& analysis) {
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);
fReadsDst = GrXPFactory::WillReadDst(xpf, analysis.fColorPOI, analysis.fCoveragePOI);
- fHasConstantPreCoverageBlendedColor = GrXPFactory::IsPreCoverageBlendedColorConstant(
- xpf, analysis.fColorPOI, &fPreCoverageBlendedColor);
sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(analysis, false, nullptr, caps));
TEST_ASSERT(!xpf->willNeedDstTexture(caps, analysis));
GrColor ignoredOverrideColor;
@@ -82,8 +80,6 @@
}
bool fReadsDst;
- bool fHasConstantPreCoverageBlendedColor;
- GrColor fPreCoverageBlendedColor;
int fOptFlags;
int fPrimaryOutputType;
int fSecondaryOutputType;
@@ -111,8 +107,6 @@
switch (xfermode) {
case SkBlendMode::kClear:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -123,7 +117,6 @@
break;
case SkBlendMode::kSrc:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -134,7 +127,6 @@
break;
case SkBlendMode::kDst:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -147,7 +139,6 @@
break;
case SkBlendMode::kSrcOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -158,7 +149,6 @@
break;
case SkBlendMode::kDstOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -169,7 +159,6 @@
break;
case SkBlendMode::kSrcIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -180,7 +169,6 @@
break;
case SkBlendMode::kDstIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -191,7 +179,6 @@
break;
case SkBlendMode::kSrcOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -202,7 +189,6 @@
break;
case SkBlendMode::kDstOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kSAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -213,7 +199,6 @@
break;
case SkBlendMode::kSrcATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -224,7 +209,6 @@
break;
case SkBlendMode::kDstATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -235,7 +219,6 @@
break;
case SkBlendMode::kXor:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -246,7 +229,6 @@
break;
case SkBlendMode::kPlus:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -257,7 +239,6 @@
break;
case SkBlendMode::kModulate:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -268,7 +249,6 @@
break;
case SkBlendMode::kScreen:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -297,8 +277,6 @@
switch (xfermode) {
case SkBlendMode::kClear:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -309,7 +287,6 @@
break;
case SkBlendMode::kSrc:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -320,7 +297,6 @@
break;
case SkBlendMode::kDst:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -333,7 +309,6 @@
break;
case SkBlendMode::kSrcOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -344,7 +319,6 @@
break;
case SkBlendMode::kDstOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -355,7 +329,6 @@
break;
case SkBlendMode::kSrcIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -366,7 +339,6 @@
break;
case SkBlendMode::kDstIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -377,7 +349,6 @@
break;
case SkBlendMode::kSrcOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -388,7 +359,6 @@
break;
case SkBlendMode::kDstOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -399,7 +369,6 @@
break;
case SkBlendMode::kSrcATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -410,7 +379,6 @@
break;
case SkBlendMode::kDstATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -421,7 +389,6 @@
break;
case SkBlendMode::kXor:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -432,7 +399,6 @@
break;
case SkBlendMode::kPlus:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -443,7 +409,6 @@
break;
case SkBlendMode::kModulate:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -454,7 +419,6 @@
break;
case SkBlendMode::kScreen:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -486,8 +450,6 @@
switch (xfermode) {
case SkBlendMode::kClear:
TEST_ASSERT(!xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -498,11 +460,6 @@
break;
case SkBlendMode::kSrc:
TEST_ASSERT(!xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(229 == GrColorUnpackR(xpi.fPreCoverageBlendedColor));
- TEST_ASSERT(0 == GrColorUnpackG(xpi.fPreCoverageBlendedColor));
- TEST_ASSERT(154 == GrColorUnpackB(xpi.fPreCoverageBlendedColor));
- TEST_ASSERT(240 == GrColorUnpackA(xpi.fPreCoverageBlendedColor));
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -513,7 +470,6 @@
break;
case SkBlendMode::kDst:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -526,7 +482,6 @@
break;
case SkBlendMode::kSrcOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -537,7 +492,6 @@
break;
case SkBlendMode::kDstOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -548,7 +502,6 @@
break;
case SkBlendMode::kSrcIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -559,7 +512,6 @@
break;
case SkBlendMode::kDstIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -570,7 +522,6 @@
break;
case SkBlendMode::kSrcOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -581,7 +532,6 @@
break;
case SkBlendMode::kDstOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -592,7 +542,6 @@
break;
case SkBlendMode::kSrcATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -603,7 +552,6 @@
break;
case SkBlendMode::kDstATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -614,7 +562,6 @@
break;
case SkBlendMode::kXor:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -625,7 +572,6 @@
break;
case SkBlendMode::kPlus:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -636,7 +582,6 @@
break;
case SkBlendMode::kModulate:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -647,7 +592,6 @@
break;
case SkBlendMode::kScreen:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -678,8 +622,6 @@
switch (xfermode) {
case SkBlendMode::kClear:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -690,7 +632,6 @@
break;
case SkBlendMode::kSrc:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -701,7 +642,6 @@
break;
case SkBlendMode::kDst:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -714,7 +654,6 @@
break;
case SkBlendMode::kSrcOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -725,7 +664,6 @@
break;
case SkBlendMode::kDstOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -736,7 +674,6 @@
break;
case SkBlendMode::kSrcIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -747,7 +684,6 @@
break;
case SkBlendMode::kDstIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -760,7 +696,6 @@
break;
case SkBlendMode::kSrcOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -771,8 +706,6 @@
break;
case SkBlendMode::kDstOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -783,7 +716,6 @@
break;
case SkBlendMode::kSrcATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -794,7 +726,6 @@
break;
case SkBlendMode::kDstATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -805,7 +736,6 @@
break;
case SkBlendMode::kXor:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -816,7 +746,6 @@
break;
case SkBlendMode::kPlus:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -827,7 +756,6 @@
break;
case SkBlendMode::kModulate:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kNone_OptFlags) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -838,7 +766,6 @@
break;
case SkBlendMode::kScreen:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -871,8 +798,6 @@
switch (xfermode) {
case SkBlendMode::kClear:
TEST_ASSERT(!xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -883,7 +808,6 @@
break;
case SkBlendMode::kSrc:
TEST_ASSERT(!xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -894,7 +818,6 @@
break;
case SkBlendMode::kDst:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -907,8 +830,6 @@
break;
case SkBlendMode::kSrcOver:
TEST_ASSERT(!xpi.fReadsDst);
- // We don't really track per-component blended output anymore.
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -919,7 +840,6 @@
break;
case SkBlendMode::kDstOver:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -930,7 +850,6 @@
break;
case SkBlendMode::kSrcIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -941,7 +860,6 @@
break;
case SkBlendMode::kDstIn:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
@@ -954,7 +872,6 @@
break;
case SkBlendMode::kSrcOut:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -965,8 +882,6 @@
break;
case SkBlendMode::kDstOut:
TEST_ASSERT(!xpi.fReadsDst);
- TEST_ASSERT(xpi.fHasConstantPreCoverageBlendedColor);
- TEST_ASSERT(GrColor_TRANSPARENT_BLACK == xpi.fPreCoverageBlendedColor);
TEST_ASSERT(kIgnoreColor_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -977,7 +892,6 @@
break;
case SkBlendMode::kSrcATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -988,7 +902,6 @@
break;
case SkBlendMode::kDstATop:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -999,7 +912,6 @@
break;
case SkBlendMode::kXor:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -1010,7 +922,6 @@
break;
case SkBlendMode::kPlus:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -1021,7 +932,6 @@
break;
case SkBlendMode::kModulate:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -1032,7 +942,6 @@
break;
case SkBlendMode::kScreen:
TEST_ASSERT(xpi.fReadsDst);
- TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor);
TEST_ASSERT(kCanTweakAlphaForCoverage_OptFlag == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -1090,9 +999,7 @@
return;
}
- GrColor color;
TEST_ASSERT(GrXPFactory::WillReadDst(xpf, colorPOI, covPOI));
- TEST_ASSERT(!GrXPFactory::IsPreCoverageBlendedColorConstant(xpf, colorPOI, &color));
GrColor overrideColor;
xp->getOptimizations(analysis, false, &overrideColor, caps);