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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrInvariantOutput.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 296893c158252c5369e74d6a7ad84f806a23f883..23ebea6afcfd9cbbb4f476edea789b46e21118d4 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -7,6 +7,7 @@
#include "GrDrawState.h"
+#include "GrInvariantOutput.h"
#include "GrOptDrawState.h"
#include "GrPaint.h"
@@ -382,15 +383,17 @@ bool GrDrawState::hasSolidCoverage() const {
return false;
}
- GrProcessor::InvariantOutput inout;
- inout.fIsSingleComponent = true;
+ GrColor color;
+ GrColorComponentFlags flags;
// Initialize to an unknown starting coverage if per-vertex coverage is specified.
if (this->hasCoverageVertexAttribute()) {
- inout.fValidFlags = 0;
+ color = 0;
+ flags = static_cast<GrColorComponentFlags>(0);
} else {
- inout.fColor = this->getCoverageColor();
- inout.fValidFlags = kRGBA_GrColorComponentFlags;
+ color = this->getCoverageColor();
+ flags = kRGBA_GrColorComponentFlags;
}
+ GrInvariantOutput inout(color, flags, true);
// check the coverage output from the GP
if (this->hasGeometryProcessor()) {
@@ -687,22 +690,22 @@ GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
bool GrDrawState::srcAlphaWillBeOne() const {
- GrProcessor::InvariantOutput inoutColor;
- inoutColor.fIsSingleComponent = false;
+ GrColor color;
+ GrColorComponentFlags flags;
// Check if per-vertex or constant color may have partial alpha
if (this->hasColorVertexAttribute()) {
if (fHints & kVertexColorsAreOpaque_Hint) {
- inoutColor.fValidFlags = kA_GrColorComponentFlag;
- inoutColor.fColor = 0xFF << GrColor_SHIFT_A;
+ flags = kA_GrColorComponentFlag;
+ color = 0xFF << GrColor_SHIFT_A;
} else {
- inoutColor.fValidFlags = 0;
- // not strictly necessary but we get false alarms from tools about uninit.
- inoutColor.fColor = 0;
+ flags = static_cast<GrColorComponentFlags>(0);
+ color = 0;
}
} else {
- inoutColor.fValidFlags = kRGBA_GrColorComponentFlags;
- inoutColor.fColor = this->getColor();
+ flags = kRGBA_GrColorComponentFlags;
+ color = this->getColor();
}
+ GrInvariantOutput inoutColor(color, flags, false);
// Run through the color stages
for (int s = 0; s < this->numColorStages(); ++s) {
@@ -714,15 +717,14 @@ bool GrDrawState::srcAlphaWillBeOne() const {
if (this->isCoverageDrawing()) {
// The shader generated for coverage drawing runs the full coverage computation and then
// makes the shader output be the multiplication of color and coverage. We mirror that here.
- GrProcessor::InvariantOutput inoutCoverage;
- inoutCoverage.fIsSingleComponent = true;
if (this->hasCoverageVertexAttribute()) {
- inoutCoverage.fValidFlags = 0;
- inoutCoverage.fColor = 0; // suppresses any warnings.
+ flags = static_cast<GrColorComponentFlags>(0);
+ color = 0;
} else {
- inoutCoverage.fValidFlags = kRGBA_GrColorComponentFlags;
- inoutCoverage.fColor = this->getCoverageColor();
+ flags = kRGBA_GrColorComponentFlags;
+ color = this->getCoverageColor();
}
+ GrInvariantOutput inoutCoverage(color, flags, true);
if (this->hasGeometryProcessor()) {
fGeometryProcessor->computeInvariantOutput(&inoutCoverage);
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrInvariantOutput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698