diff options
author | Brian Salomon <bsalomon@google.com> | 2017-02-14 10:28:22 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-14 16:06:13 +0000 |
commit | 9a51498720e234b413e5a3c46d38ab40bda131de (patch) | |
tree | d9eab53b0bc23e4d5b3f575552fdac5e83c588e5 /tests | |
parent | 8a8937c3d18e42f5d878885b40f3c1f8140627b7 (diff) |
Remove component flags from GrXPFactory output analysis.
Change-Id: Ieb8dab564e6e593dca2e092d352756052dadfd90
Reviewed-on: https://skia-review.googlesource.com/8354
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrPorterDuffTest.cpp | 343 |
1 files changed, 170 insertions, 173 deletions
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index f4bf85160f..133d2b7e72 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -68,9 +68,11 @@ public: XPInfo(skiatest::Reporter* reporter, SkBlendMode xfermode, const GrCaps& caps, 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)); - xpf->getInvariantBlendedColor(analysis.fColorPOI, &fBlendedColor); GrColor ignoredOverrideColor; fOptFlags = xp->getOptimizations(analysis, false, &ignoredOverrideColor, caps); GetXPOutputTypes(xp.get(), &fPrimaryOutputType, &fSecondaryOutputType); @@ -79,7 +81,9 @@ public: TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend)); } - GrXPFactory::InvariantBlendedColor fBlendedColor; + bool fReadsDst; + bool fHasConstantPreCoverageBlendedColor; + GrColor fPreCoverageBlendedColor; int fOptFlags; int fPrimaryOutputType; int fSecondaryOutputType; @@ -105,12 +109,11 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { SkBlendMode xfermode = static_cast<SkBlendMode>(m); const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); - switch (xfermode) { case SkBlendMode::kClear: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -120,8 +123,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrc: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -131,8 +134,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDst: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -144,8 +147,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -155,8 +158,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -166,8 +169,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -177,8 +180,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -188,8 +191,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -199,8 +202,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -210,8 +213,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -221,8 +224,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -232,8 +235,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kXor: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -243,8 +246,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kPlus: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -254,8 +257,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kModulate: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -265,8 +268,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kScreen: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -294,12 +297,11 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { SkBlendMode xfermode = static_cast<SkBlendMode>(m); const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); - switch (xfermode) { case SkBlendMode::kClear: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +311,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrc: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +322,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDst: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -333,8 +335,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +346,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +357,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +368,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +379,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +390,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +401,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +412,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +423,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kXor: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +434,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kPlus: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +445,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kModulate: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,8 +456,8 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kScreen: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -484,12 +486,11 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { SkBlendMode xfermode = static_cast<SkBlendMode>(m); const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); - switch (xfermode) { case SkBlendMode::kClear: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -499,12 +500,12 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrc: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(229 == GrColorUnpackR(xpi.fBlendedColor.fKnownColor)); - TEST_ASSERT(0 == GrColorUnpackG(xpi.fBlendedColor.fKnownColor)); - TEST_ASSERT(154 == GrColorUnpackB(xpi.fBlendedColor.fKnownColor)); - TEST_ASSERT(240 == GrColorUnpackA(xpi.fBlendedColor.fKnownColor)); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -514,8 +515,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDst: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -527,8 +528,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -538,8 +539,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -549,8 +550,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -560,8 +561,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -571,8 +572,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -582,8 +583,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -593,8 +594,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -604,8 +605,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -615,8 +616,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kXor: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -626,8 +627,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kPlus: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -637,8 +638,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kModulate: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -648,8 +649,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kScreen: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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,12 +679,11 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { SkBlendMode xfermode = static_cast<SkBlendMode>(m); const GrPorterDuffTest::XPInfo xpi(reporter, xfermode, caps, analysis); - switch (xfermode) { case SkBlendMode::kClear: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -693,9 +693,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrc: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - // We don't really track per-component blended output anymore. - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -705,8 +704,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDst: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -718,9 +717,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOver: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - // We don't really track per-component blended output anymore. - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -730,8 +728,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -741,8 +739,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -752,8 +750,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -765,8 +763,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -776,9 +774,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOut: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -788,8 +786,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -799,8 +797,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -810,8 +808,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kXor: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -821,8 +819,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kPlus: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -832,8 +830,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kModulate: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -843,8 +841,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kScreen: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -877,9 +875,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr switch (xfermode) { case SkBlendMode::kClear: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -889,9 +887,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrc: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); + TEST_ASSERT(!xpi.fReadsDst); // We don't really track per-component blended output anymore. - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); @@ -901,8 +899,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDst: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -914,9 +912,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOver: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); + TEST_ASSERT(!xpi.fReadsDst); // We don't really track per-component blended output anymore. - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT(kNone_OptFlags == xpi.fOptFlags); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); @@ -926,8 +924,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOver: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -937,8 +935,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -948,8 +946,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstIn: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + TEST_ASSERT(xpi.fReadsDst); + TEST_ASSERT(!xpi.fHasConstantPreCoverageBlendedColor); TEST_ASSERT((kSkipDraw_OptFlag | kIgnoreColor_OptFlag | kCanTweakAlphaForCoverage_OptFlag) == xpi.fOptFlags); @@ -961,8 +959,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcOut: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -972,9 +970,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstOut: - TEST_ASSERT(!xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(0 == xpi.fBlendedColor.fKnownColor); - TEST_ASSERT(kRGBA_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -984,8 +982,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kSrcATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -995,8 +993,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kDstATop: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -1006,8 +1004,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kXor: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -1017,8 +1015,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kPlus: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -1028,8 +1026,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kModulate: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -1039,8 +1037,8 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr TEST_ASSERT(xpi.fBlendInfo.fWriteColor); break; case SkBlendMode::kScreen: - TEST_ASSERT(xpi.fBlendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == xpi.fBlendedColor.fKnownColorFlags); + 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); @@ -1099,10 +1097,9 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const return; } - GrXPFactory::InvariantBlendedColor blendedColor; - xpf->getInvariantBlendedColor(colorPOI, &blendedColor); - TEST_ASSERT(blendedColor.fWillBlendWithDst); - TEST_ASSERT(kNone_GrColorComponentFlags == blendedColor.fKnownColorFlags); + GrColor color; + TEST_ASSERT(GrXPFactory::WillReadDst(xpf, colorPOI, covPOI)); + TEST_ASSERT(!GrXPFactory::IsPreCoverageBlendedColorConstant(xpf, colorPOI, &color)); GrColor overrideColor; xp->getOptimizations(analysis, false, &overrideColor, caps); |