diff options
author | Greg Daniel <egdaniel@google.com> | 2017-05-19 10:56:46 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-19 17:20:33 +0000 |
commit | 6ebe4b9dbeab68ca3b6da61fd08f22cdc080267d (patch) | |
tree | 7cd35d97370f7d85d6422a71b044c62930d20cc6 /tests | |
parent | 09e9f68625db41a1bdbac6738e2d4b57268ac5ca (diff) |
Fix gpu lcd blending to semi-correctly handle alpha coverage
Bug: skia:6606
Change-Id: I16ccd97f5d047eb7fddfed5310bf669e7435ccdd
Reviewed-on: https://skia-review.googlesource.com/17370
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrPorterDuffTest.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 780573d34f..f000077f8a 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -104,7 +104,7 @@ public: }; static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { - GrProcessorAnalysisColor inputColor = GrProcessorAnalysisColor::Opaque::kNo; + GrProcessorAnalysisColor inputColor = GrProcessorAnalysisColor::Opaque::kYes; GrProcessorAnalysisCoverage inputCoverage = GrProcessorAnalysisCoverage::kLCD; for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) { @@ -1004,10 +1004,26 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps) { const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver); - GrProcessorAnalysisColor color = GrColorPackRGBA(123, 45, 67, 221); + GrProcessorAnalysisColor color = GrColorPackRGBA(123, 45, 67, 255); GrProcessorAnalysisCoverage coverage = GrProcessorAnalysisCoverage::kLCD; - SkASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) & - GrXPFactory::AnalysisProperties::kRequiresDstTexture)); + TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) & + GrXPFactory::AnalysisProperties::kRequiresDstTexture)); + sk_sp<const GrXferProcessor> xp_opaque( + GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps)); + if (!xp_opaque) { + ERRORF(reporter, "Failed to create an XP with LCD coverage."); + return; + } + + GrXferProcessor::BlendInfo blendInfo; + xp_opaque->getBlendInfo(&blendInfo); + TEST_ASSERT(blendInfo.fWriteColor); + + // Test with non-opaque alpha + color = GrColorPackRGBA(123, 45, 67, 221); + coverage = GrProcessorAnalysisCoverage::kLCD; + TEST_ASSERT(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) & + GrXPFactory::AnalysisProperties::kRequiresDstTexture); sk_sp<const GrXferProcessor> xp( GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps)); if (!xp) { @@ -1015,7 +1031,6 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const return; } - GrXferProcessor::BlendInfo blendInfo; xp->getBlendInfo(&blendInfo); TEST_ASSERT(blendInfo.fWriteColor); } |