Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: src/gpu/effects/GrPorterDuffXferProcessor.cpp

Issue 927623002: Determine whether we can tweakAlphaForCoverage during Pipeline/XP creation. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: review nit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrPorterDuffXferProcessor.cpp
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 6f2b63f5cb2b53977041fef563d89e30be9ead65..428b76a38a12002148c720eadb534ba80b0a644a 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -330,7 +330,13 @@ PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
// check whether coverage can be safely rolled into alpha
// of if we can skip color computation and just emit coverage
if (can_tweak_alpha_for_coverage(fDstBlend)) {
- return GrXferProcessor::kSetCoverageDrawing_OptFlag;
+ if (colorPOI.allStagesMultiplyInput()) {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag |
+ GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
+ } else {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag;
+
+ }
}
if (dstCoeffIsZero) {
if (kZero_GrBlendCoeff == fSrcBlend) {
@@ -346,12 +352,25 @@ PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
// If Sa is 1 then we can replace Sa with c
// and set dst coeff to 1-Sa.
fDstBlend = kISA_GrBlendCoeff;
- return GrXferProcessor::kSetCoverageDrawing_OptFlag;
+ if (colorPOI.allStagesMultiplyInput()) {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag |
+ GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
+ } else {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag;
+
+ }
}
} else if (dstCoeffIsOne) {
// the dst coeff is effectively one so blend works out to:
// cS + (c)(1)D + (1-c)D = cS + D.
fDstBlend = kOne_GrBlendCoeff;
+ if (colorPOI.allStagesMultiplyInput()) {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag |
+ GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
+ } else {
+ return GrXferProcessor::kSetCoverageDrawing_OptFlag;
+
+ }
return GrXferProcessor::kSetCoverageDrawing_OptFlag;
}
}
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698