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

Unified Diff: src/gpu/GrPaint.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite Created 6 years, 2 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/GrOvalRenderer.cpp ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPaint.cpp
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 84fdf420e269819e7eda6163d8ebee796b7c6008..ffde5f99e4116dbf920065d4c529ce481435da3d 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -52,28 +52,32 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
// TODO: Share this implementation with GrDrawState
- GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage);
- uint32_t coverageComps = kRGBA_GrColorComponentFlags;
+ GrProcessor::InvariantOutput inout;
+ inout.fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage);
+ inout.fValidFlags = kRGBA_GrColorComponentFlags;
+ inout.fIsSingleComponent = false;
int count = fCoverageStages.count();
for (int i = 0; i < count; ++i) {
- fCoverageStages[i].getProcessor()->getConstantColorComponents(&coverage, &coverageComps);
+ fCoverageStages[i].getProcessor()->computeInvariantOutput(&inout);
}
- if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage) {
+ if (!inout.isSolidWhite()) {
return false;
}
- GrColor color = fColor;
- uint32_t colorComps = kRGBA_GrColorComponentFlags;
+ inout.fColor = fColor;
+ inout.fValidFlags = kRGBA_GrColorComponentFlags;
+ inout.fIsSingleComponent = false;
count = fColorStages.count();
for (int i = 0; i < count; ++i) {
- fColorStages[i].getProcessor()->getConstantColorComponents(&color, &colorComps);
+ fColorStages[i].getProcessor()->computeInvariantOutput(&inout);
}
SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents));
GrBlendCoeff srcCoeff = fSrcBlendCoeff;
GrBlendCoeff dstCoeff = fDstBlendCoeff;
- GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0);
+ GrSimplifyBlend(&srcCoeff, &dstCoeff, inout.fColor, inout.fValidFlags,
+ 0, 0, 0);
bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoeff);
if (solidColor) {
@@ -85,8 +89,8 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
break;
case kOne_GrBlendCoeff:
- *solidColor = color;
- *solidColorKnownComponents = colorComps;
+ *solidColor = inout.fColor;
+ *solidColorKnownComponents = inout.fValidFlags;
break;
// The src coeff should never refer to the src and if it refers to dst then opaque
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698