aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcdalton <cdalton@nvidia.com>2015-06-02 10:43:39 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-02 10:43:39 -0700
commit1fa4572d1a32e9fbf102d7388efe5e44bef460f1 (patch)
tree6c345ece354d8ff9cf45fa3051181ff09fbbbf45
parentd58d74ab582135be592f47e4ecc597b26607ed8a (diff)
downloadskia-1fa4572d1a32e9fbf102d7388efe5e44bef460f1.tar.gz
Update XPF invariant info to not account for conflation
Renames getInvariantOutput to getInvariantBlendedColor on GrXPFactory and redefines it to not account for coverage conflation. This is the information that all the callsites actually wanted to know. BUG=skia: Review URL: https://codereview.chromium.org/1161273005
-rw-r--r--include/gpu/GrPaint.h8
-rw-r--r--include/gpu/GrXferProcessor.h22
-rw-r--r--include/gpu/effects/GrCoverageSetOpXP.h4
-rw-r--r--include/gpu/effects/GrPorterDuffXferProcessor.h4
-rw-r--r--src/effects/SkArithmeticMode_gpu.cpp17
-rw-r--r--src/effects/SkArithmeticMode_gpu.h4
-rw-r--r--src/gpu/GrDrawContext.cpp2
-rw-r--r--src/gpu/GrDrawTarget.h4
-rw-r--r--src/gpu/GrInOrderCommandBuilder.cpp36
-rw-r--r--src/gpu/GrPaint.cpp14
-rw-r--r--src/gpu/GrPipelineBuilder.cpp9
-rw-r--r--src/gpu/GrPipelineBuilder.h10
-rw-r--r--src/gpu/GrProcOptInfo.h5
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp20
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp9
-rw-r--r--src/gpu/effects/GrCustomXfermodePriv.h4
-rw-r--r--src/gpu/effects/GrDisableColorXP.h8
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp40
-rw-r--r--tests/GrPorterDuffTest.cpp275
19 files changed, 244 insertions, 251 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index bf2969311..75d3a2d0d 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -129,10 +129,12 @@ public:
}
/**
- * Returns true if isOpaque would return true and the paint represents a solid constant color
- * draw. If the result is true, constantColor will be updated to contain the constant color.
+ * Returns true if the paint's output color will be constant after blending. If the result is
+ * true, constantColor will be updated to contain the constant color. Note that we can conflate
+ * coverage and color, so the actual values written to pixels with partial coverage may still
+ * not seem constant, even if this function returns true.
*/
- bool isOpaqueAndConstantColor(GrColor* constantColor) const;
+ bool isConstantBlendedColor(GrColor* constantColor) const;
private:
mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 812a9b32a..d39163c6d 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -363,19 +363,23 @@ public:
*/
virtual bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const = 0;
- struct InvariantOutput {
- bool fWillBlendWithDst;
- GrColor fBlendedColor;
- uint32_t fBlendedColorFlags;
+ /**
+ * Known color information after blending, but before accounting for any coverage.
+ */
+ struct InvariantBlendedColor {
+ bool fWillBlendWithDst;
+ GrColor fKnownColor;
+ GrColorComponentFlags fKnownColorFlags;
};
/**
- * This function returns known information about the output of the xfer processor produced by
- * this xp factory. The invariant color information returned by this function refers to the
- * final color produced after all blending.
+ * Returns information about the output color, produced by XPs from this factory, that will be
+ * known after blending. Note that we can conflate coverage and color, so the actual values
+ * written to pixels with partial coverage may not always seem consistent with the invariant
+ * information returned by this function.
*/
- virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- InvariantOutput*) const = 0;
+ virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ InvariantBlendedColor*) const = 0;
bool willNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const;
diff --git a/include/gpu/effects/GrCoverageSetOpXP.h b/include/gpu/effects/GrCoverageSetOpXP.h
index 2f4530c30..6067b5eeb 100644
--- a/include/gpu/effects/GrCoverageSetOpXP.h
+++ b/include/gpu/effects/GrCoverageSetOpXP.h
@@ -28,8 +28,8 @@ public:
return true;
}
- void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput*) const override;
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor*) const override;
private:
GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index e4f72203f..ca7de9415 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -20,8 +20,8 @@ public:
bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const override;
- void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput*) const override;
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor*) const override;
private:
GrPorterDuffXPFactory(SkXfermode::Mode);
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 3b815e521..d0dd98b36 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -306,15 +306,14 @@ GrArithmeticXPFactory::onCreateXferProcessor(const GrCaps& caps,
}
-void GrArithmeticXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput* output) const {
- output->fWillBlendWithDst = true;
-
- // TODO: We could try to optimize this more. For example if we have solid coverage and fK1 and
- // fK3 are zero, then we won't be blending the color with dst at all so we can know what the
- // output color is (up to the valid color components passed in).
- output->fBlendedColorFlags = 0;
+void GrArithmeticXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ InvariantBlendedColor* blendedColor) const {
+ blendedColor->fWillBlendWithDst = true;
+
+ // TODO: We could try to optimize this more. For example if fK1 and fK3 are zero, then we won't
+ // be blending the color with dst at all so we can know what the output color is (up to the
+ // valid color components passed in).
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
}
GR_DEFINE_XP_FACTORY_TEST(GrArithmeticXPFactory);
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index 0c1e9d72f..3334e2dce 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -81,8 +81,8 @@ public:
return true;
}
- void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput*) const override;
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor*) const override;
private:
GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePMColor);
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 29318862c..92a1e36f1 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -412,7 +412,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
rect_contains_inclusive(rect, srcSpaceRTQuad[3])) {
// Will it blend?
GrColor clearColor;
- if (paint.isOpaqueAndConstantColor(&clearColor)) {
+ if (paint.isConstantBlendedColor(&clearColor)) {
fDrawTarget->clear(NULL, clearColor, true, rt);
return;
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index c1eca9a81..30a6cee4f 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -229,8 +229,8 @@ protected:
const GrBatch* batch, const SkRect* devBounds,
GrDrawTarget* target);
- bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const {
- return fPipelineBuilder->willBlendWithDst(primProc);
+ bool willColorBlendWithDst(const GrPrimitiveProcessor* primProc) const {
+ return fPipelineBuilder->willColorBlendWithDst(primProc);
}
private:
friend class GrDrawTarget;
diff --git a/src/gpu/GrInOrderCommandBuilder.cpp b/src/gpu/GrInOrderCommandBuilder.cpp
index e56607b57..6d942449e 100644
--- a/src/gpu/GrInOrderCommandBuilder.cpp
+++ b/src/gpu/GrInOrderCommandBuilder.cpp
@@ -90,30 +90,30 @@ GrInOrderCommandBuilder::recordDrawPaths(State* state,
if (!this->cmdBuffer()->empty() &&
Cmd::kDrawPaths_CmdType == this->cmdBuffer()->back().type()) {
- // The previous command was also DrawPaths. Try to collapse this call into the one
- // before. Note that stenciling all the paths at once, then covering, may not be
- // equivalent to two separate draw calls if there is overlap. Blending won't work,
- // and the combined calls may also cancel each other's winding numbers in some
- // places. For now the winding numbers are only an issue if the fill is even/odd,
- // because DrawPaths is currently only used for glyphs, and glyphs in the same
- // font tend to all wind in the same direction.
+ // Try to combine this call with the previous DrawPaths. We do this by stenciling all the
+ // paths together and then covering them in a single pass. This is not equivalent to two
+ // separate draw calls, so we can only do it if there is no blending (no overlap would also
+ // work). Note that it's also possible for overlapping paths to cancel each other's winding
+ // numbers, and we only partially account for this by not allowing even/odd paths to be
+ // combined. (Glyphs in the same font tend to wind the same direction so it works out OK.)
DrawPaths* previous = static_cast<DrawPaths*>(&this->cmdBuffer()->back());
if (pathRange == previous->pathRange() &&
indexType == previous->fIndexType &&
transformType == previous->fTransformType &&
stencilSettings == previous->fStencilSettings &&
path_fill_type_is_winding(stencilSettings) &&
- !pipelineInfo.willBlendWithDst(pathProc) &&
- previous->fState == state) {
- const int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
- const int xformSize = GrPathRendering::PathTransformSize(transformType);
- if (&previous->fIndices[previous->fCount*indexBytes] == savedIndices &&
- (0 == xformSize ||
- &previous->fTransforms[previous->fCount*xformSize] == savedTransforms)) {
- // Fold this DrawPaths call into the one previous.
- previous->fCount += count;
- return NULL;
- }
+ previous->fState == state &&
+ !pipelineInfo.willColorBlendWithDst(pathProc)) {
+
+ const int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
+ const int xformSize = GrPathRendering::PathTransformSize(transformType);
+ if (&previous->fIndices[previous->fCount * indexBytes] == savedIndices &&
+ (0 == xformSize ||
+ &previous->fTransforms[previous->fCount * xformSize] == savedTransforms)) {
+ // Combine this DrawPaths call with the one previous.
+ previous->fCount += count;
+ return NULL;
+ }
}
}
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index c9cebad9d..3c40c96d1 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -43,20 +43,16 @@ void GrPaint::addCoverageTextureProcessor(GrTexture* texture,
this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix, params))->unref();
}
-bool GrPaint::isOpaqueAndConstantColor(GrColor* color) const {
- GrProcOptInfo coverageProcInfo;
- coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCoverageStages(),
- 0xFFFFFFFF, kRGBA_GrColorComponentFlags, true);
+bool GrPaint::isConstantBlendedColor(GrColor* color) const {
GrProcOptInfo colorProcInfo;
colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStages(), fColor,
kRGBA_GrColorComponentFlags, false);
- GrXPFactory::InvariantOutput output;
- fXPFactory->getInvariantOutput(colorProcInfo, coverageProcInfo, &output);
+ GrXPFactory::InvariantBlendedColor blendedColor;
+ fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor);
- if (kRGBA_GrColorComponentFlags == output.fBlendedColorFlags &&
- 0xFF == GrColorUnpackA(output.fBlendedColor)) {
- *color = output.fBlendedColor;
+ if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) {
+ *color = blendedColor.fKnownColor;
return true;
}
return false;
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index f34476e10..8af89e8c1 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -123,13 +123,12 @@ GrPipelineBuilder::~GrPipelineBuilder() {
////////////////////////////////////////////////////////////////////////////////
-bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const {
+bool GrPipelineBuilder::willColorBlendWithDst(const GrPrimitiveProcessor* pp) const {
this->calcColorInvariantOutput(pp);
- this->calcCoverageInvariantOutput(pp);
- GrXPFactory::InvariantOutput output;
- fXPFactory->getInvariantOutput(fColorProcInfo, fCoverageProcInfo, &output);
- return output.fWillBlendWithDst;
+ GrXPFactory::InvariantBlendedColor blendedColor;
+ fXPFactory->getInvariantBlendedColor(fColorProcInfo, &blendedColor);
+ return blendedColor.fWillBlendWithDst;
}
void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 09b4f91e7..dbbf98a81 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -139,10 +139,12 @@ public:
////
/**
- * This function returns true if the render target destination pixel values will be read for
- * blending during draw.
+ * Returns true if this pipeline's color output will be affected by the existing render target
+ * destination pixel values (meaning we need to be careful with overlapping draws). Note that we
+ * can conflate coverage and color, so the destination color may still bleed into pixels that
+ * have partial coverage, even if this function returns false.
*/
- bool willBlendWithDst(const GrPrimitiveProcessor*) const;
+ bool willColorBlendWithDst(const GrPrimitiveProcessor*) const;
/**
* Installs a GrXPFactory. This object controls how src color, fractional pixel coverage,
@@ -387,7 +389,7 @@ private:
//
// canUseFracCoveragePrimProc() - Called in regular skia draw, caches results but only for a
// specific color and coverage. May be called multiple times
- // willBlendWithDst() - only called by Nvpr, does not cache results
+ // willColorBlendWithDst() - only called by Nvpr, does not cache results
// GrOptDrawState constructor - never caches results
/**
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h
index 059bca4dd..f518172e2 100644
--- a/src/gpu/GrProcOptInfo.h
+++ b/src/gpu/GrProcOptInfo.h
@@ -54,7 +54,10 @@ public:
fInOut.isLCDCoverage(); }
GrColor color() const { return fInOut.color(); }
- uint8_t validFlags() const { return fInOut.validFlags(); }
+
+ GrColorComponentFlags validFlags() const {
+ return static_cast<GrColorComponentFlags>(fInOut.validFlags());
+ }
/**
* Returns the index of the first effective color stage. If an intermediate stage doesn't read
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index 92a5c689a..a0edfe71f 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -230,22 +230,10 @@ GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
}
-void GrCoverageSetOpXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput* output) const {
- if (SkRegion::kReplace_Op == fRegionOp) {
- if (coveragePOI.isSolidWhite()) {
- output->fBlendedColor = GrColor_WHITE;
- output->fBlendedColorFlags = kRGBA_GrColorComponentFlags;
- } else {
- output->fBlendedColorFlags = 0;
- }
-
- output->fWillBlendWithDst = false;
- } else {
- output->fBlendedColorFlags = 0;
- output->fWillBlendWithDst = true;
- }
+void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ InvariantBlendedColor* blendedColor) const {
+ blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp;
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
}
GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory);
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index be2b343d4..ba355c5de 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -807,11 +807,10 @@ bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps,
return false;
}
-void GrCustomXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput* output) const {
- output->fWillBlendWithDst = true;
- output->fBlendedColorFlags = 0;
+void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ InvariantBlendedColor* blendedColor) const {
+ blendedColor->fWillBlendWithDst = true;
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
}
GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
diff --git a/src/gpu/effects/GrCustomXfermodePriv.h b/src/gpu/effects/GrCustomXfermodePriv.h
index f7fccca73..4a6bc7ac2 100644
--- a/src/gpu/effects/GrCustomXfermodePriv.h
+++ b/src/gpu/effects/GrCustomXfermodePriv.h
@@ -64,8 +64,8 @@ public:
return true;
}
- void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput*) const override;
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor*) const override;
private:
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index 6289834b5..ee2ed5300 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -23,10 +23,10 @@ public:
return true;
}
- void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput* output) const override {
- output->fBlendedColorFlags = 0;
- output->fWillBlendWithDst = 0;
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor* blendedColor) const override {
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
+ blendedColor->fWillBlendWithDst = false;
}
private:
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 812cfeaaa..83c72f934 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -709,6 +709,7 @@ PDLCDXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
GrPorterDuffXPFactory::GrPorterDuffXPFactory(SkXfermode::Mode xfermode)
: fXfermode(xfermode) {
+ SkASSERT(fXfermode <= SkXfermode::kLastCoeffMode);
this->initClassID<GrPorterDuffXPFactory>();
}
@@ -770,39 +771,34 @@ bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/,
return false;
}
-void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- GrXPFactory::InvariantOutput* output) const {
- output->fWillBlendWithDst = true;
- output->fBlendedColorFlags = kNone_GrColorComponentFlags;
-
- // The blend table doesn't support LCD coverage, but these formulas never have invariant output.
- if (coveragePOI.isFourChannelOutput()) {
+void GrPorterDuffXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ InvariantBlendedColor* blendedColor) const {
+ // Find the blended color info based on the formula that does not have coverage.
+ BlendFormula colorFormula = gBlendTable[colorPOI.isOpaque()][0][fXfermode];
+ if (colorFormula.usesDstColor()) {
+ blendedColor->fWillBlendWithDst = true;
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
return;
}
- const BlendFormula& blendFormula = get_blend_formula(fXfermode, colorPOI, coveragePOI);
- if (blendFormula.usesDstColor()) {
- return;
- }
+ blendedColor->fWillBlendWithDst = false;
- SkASSERT(coveragePOI.isSolidWhite());
- SkASSERT(kAdd_GrBlendEquation == blendFormula.fBlendEquation);
+ SkASSERT(kAdd_GrBlendEquation == colorFormula.fBlendEquation);
- output->fWillBlendWithDst = false;
-
- switch (blendFormula.fSrcCoeff) {
+ switch (colorFormula.fSrcCoeff) {
case kZero_GrBlendCoeff:
- output->fBlendedColor = 0;
- output->fBlendedColorFlags = kRGBA_GrColorComponentFlags;
+ blendedColor->fKnownColor = 0;
+ blendedColor->fKnownColorFlags = kRGBA_GrColorComponentFlags;
return;
case kOne_GrBlendCoeff:
- output->fBlendedColor = colorPOI.color();
- output->fBlendedColorFlags = colorPOI.validFlags();
+ blendedColor->fKnownColor = colorPOI.color();
+ blendedColor->fKnownColorFlags = colorPOI.validFlags();
return;
- default: return;
+ default:
+ blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
+ return;
}
}
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 41a8b5aa5..c56af1df0 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -77,7 +77,7 @@ public:
SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode));
SkAutoTUnref<GrXferProcessor> xp(xpf->createXferProcessor(colorPOI, covPOI, 0, caps));
TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI));
- xpf->getInvariantOutput(colorPOI, covPOI, &fInvariantOutput);
+ xpf->getInvariantBlendedColor(colorPOI, &fBlendedColor);
fOptFlags = xp->getOptimizations(colorPOI, covPOI, false, 0, caps);
GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType);
xp->getBlendInfo(&fBlendInfo);
@@ -85,7 +85,7 @@ public:
TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend));
}
- GrXPFactory::InvariantOutput fInvariantOutput;
+ GrXPFactory::InvariantBlendedColor fBlendedColor;
int fOptFlags;
int fPrimaryOutputType;
int fSecondaryOutputType;
@@ -113,8 +113,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
switch (xfermode) {
case SkXfermode::kClear_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -124,8 +125,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrc_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -135,8 +136,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDst_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -149,8 +150,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -160,8 +161,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -171,8 +172,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -182,8 +183,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -193,8 +194,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
@@ -204,8 +205,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -215,8 +216,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -226,8 +227,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
@@ -237,8 +238,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kXor_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -248,8 +249,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kPlus_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -259,8 +260,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kModulate_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -270,8 +271,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kScreen_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -304,9 +305,9 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
switch (xfermode) {
case SkXfermode::kClear_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(0 == xpi.fInvariantOutput.fBlendedColor);
- TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
@@ -317,11 +318,11 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrc_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(229 == GrColorUnpackR(xpi.fInvariantOutput.fBlendedColor));
- TEST_ASSERT(154 == GrColorUnpackB(xpi.fInvariantOutput.fBlendedColor));
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(229 == GrColorUnpackR(xpi.fBlendedColor.fKnownColor));
+ TEST_ASSERT(154 == GrColorUnpackB(xpi.fBlendedColor.fKnownColor));
TEST_ASSERT((kR_GrColorComponentFlag |
- kB_GrColorComponentFlag) == xpi.fInvariantOutput.fBlendedColorFlags);
+ kB_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -331,8 +332,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDst_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -345,8 +346,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -357,8 +358,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -369,8 +370,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -380,8 +381,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -391,8 +392,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -402,8 +403,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -414,8 +415,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -426,8 +427,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -437,8 +438,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kXor_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -449,8 +450,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kPlus_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -461,8 +462,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kModulate_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -472,8 +473,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kScreen_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -506,8 +507,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
switch (xfermode) {
case SkXfermode::kClear_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -517,8 +519,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrc_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
+ TEST_ASSERT(kA_GrColorComponentFlag == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -528,8 +531,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDst_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -542,8 +545,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
+ TEST_ASSERT(kA_GrColorComponentFlag == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -553,8 +557,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -564,8 +568,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -575,8 +579,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -589,8 +593,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -600,8 +604,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -611,8 +616,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -622,8 +627,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -633,8 +638,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kXor_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -644,8 +649,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kPlus_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -655,8 +660,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kModulate_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kNone_Opt) == xpi.fOptFlags);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -666,8 +671,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kScreen_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -700,9 +705,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
switch (xfermode) {
case SkXfermode::kClear_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(0 == xpi.fInvariantOutput.fBlendedColor);
- TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
@@ -713,11 +718,11 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrc_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(82 == GrColorUnpackG(xpi.fInvariantOutput.fBlendedColor));
- TEST_ASSERT(255 == GrColorUnpackA(xpi.fInvariantOutput.fBlendedColor));
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(82 == GrColorUnpackG(xpi.fBlendedColor.fKnownColor));
+ TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
TEST_ASSERT((kG_GrColorComponentFlag |
- kA_GrColorComponentFlag) == xpi.fInvariantOutput.fBlendedColorFlags);
+ kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -727,8 +732,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDst_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -741,11 +746,11 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOver_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(82 == GrColorUnpackG(xpi.fInvariantOutput.fBlendedColor));
- TEST_ASSERT(255 == GrColorUnpackA(xpi.fInvariantOutput.fBlendedColor));
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(82 == GrColorUnpackG(xpi.fBlendedColor.fKnownColor));
+ TEST_ASSERT(255 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor));
TEST_ASSERT((kG_GrColorComponentFlag |
- kA_GrColorComponentFlag) == xpi.fInvariantOutput.fBlendedColorFlags);
+ kA_GrColorComponentFlag) == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -755,8 +760,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOver_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -767,8 +772,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -778,8 +783,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstIn_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kSkipDraw_OptFlag |
kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag |
@@ -792,8 +797,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcOut_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -803,9 +808,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstOut_Mode:
- TEST_ASSERT(!xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(0 == xpi.fInvariantOutput.fBlendedColor);
- TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor);
+ TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreColor_OptFlag |
kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
@@ -816,8 +821,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kSrcATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -827,8 +832,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kDstATop_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -839,8 +844,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kXor_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -850,8 +855,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kPlus_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -862,8 +867,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kModulate_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
@@ -873,8 +878,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break;
case SkXfermode::kScreen_Mode:
- TEST_ASSERT(xpi.fInvariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fInvariantOutput.fBlendedColorFlags);
+ TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags);
TEST_ASSERT((kIgnoreCoverage_OptFlag |
kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
@@ -925,10 +930,10 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
return;
}
- GrXPFactory::InvariantOutput invariantOutput;
- xpf->getInvariantOutput(colorPOI, covPOI, &invariantOutput);
- TEST_ASSERT(invariantOutput.fWillBlendWithDst);
- TEST_ASSERT(kNone_GrColorComponentFlags == invariantOutput.fBlendedColorFlags);
+ GrXPFactory::InvariantBlendedColor blendedColor;
+ xpf->getInvariantBlendedColor(colorPOI, &blendedColor);
+ TEST_ASSERT(blendedColor.fWillBlendWithDst);
+ TEST_ASSERT(kNone_GrColorComponentFlags == blendedColor.fKnownColorFlags);
GrColor overrideColor;
xp->getOptimizations(colorPOI, covPOI, false, &overrideColor, caps);